flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Tomasz Grysztar 04 Jan 2006, 13:01
For preprocessor the blanks are already non-existing (like the comments), the "2 2" is for preprocessor the sequence of two symbols just like "2+2" is the sequence of three (undistinguishable from "2 + 2").
If you want just two symbols, use "irps" and limit it to two first ones. |
|||
![]() |
|
Borsuc 04 Jan 2006, 13:10
How can you limit it to first 2 symbols? does % work here (I think it works only for assembler).
maybe I'll need this: how to tell where a space ' ' has occured? Like alpha beta alpha+ss beta and match to make it work, variable 1 contains alpha+ss and variable 2 beta? still, not even my previously posted macro will work ![]() If I do this: match var1 var2 it will put alpha in var1 and ss in var2, which of course, it's not what I intended. just wanted to know if it's possible to do it in some 'trick' or maybe something else. thx again EDIT: oops, sorry.. I wrote the first code wrong.. It should've been match , false, not match +, false.. sorry ![]() |
|||
![]() |
|
Tomasz Grysztar 04 Jan 2006, 13:30
Well, actually I perhaps misguided you a bit. To get the two symbols it's better to use just a few matches. Like:
Code: define expr 2+2 match car cdr, expr { define a car define b cdr } match car cdr, b { --error -- } ; more than two symbols And note once more: for preprocessor there are no spaces, "alpha+ss beta" is the sequence of "alpha", "+", "ss" and "beta" symbols, it doesn't matter whether there were some additional spaces between them or not. |
|||
![]() |
|
Borsuc 04 Jan 2006, 13:33
Now it works.. why define a car? seems it not used.
thanks for the tip. I understand it better ![]() |
|||
![]() |
|
Tomasz Grysztar 04 Jan 2006, 14:57
Well, you did "match a b" initially, so I defined the "a" and "b" symbols in this example.
|
|||
![]() |
|
Borsuc 04 Jan 2006, 15:01
Ok, got it. Thanks
![]() |
|||
![]() |
|
Reverend 04 Jan 2006, 16:46
Tomasz: Wouldn't it be better to make preprocessor work for symbols only separated with space? Coder can always write match '2 + 2' instead of '2+2'. It would be much easier and IMHO more intuitive. You would always know that '2+2' is one symbol and we would need no such (IMO) messy solutions to distinguish symbols.
|
|||
![]() |
|
Tomasz Grysztar 04 Jan 2006, 17:08
Better or not, it would require completely different preprocessor philosophy, thus writing something completely different than flat assembler is now.
Also note that for assembler "2+not 2" is also a single token (single numerical expression). And for preprocessor it's just four tokens. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.