flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > reserved words conflict with labels |
Author |
|
rugxulo 27 Sep 2009, 18:39
Is it not easy to make FASM accept reserved words as labels? For instance, 1.69.05 broke my recent conversion of BEFI due to the new interpreter keyword (despite it being a Linux-only use and this program being DOS only, heh).
|
|||
27 Sep 2009, 18:39 |
|
Tomasz Grysztar 27 Sep 2009, 18:46
The assembler would still work with those checks removed, however they are there to prevent the ambiguity.
You may try using something like "undefine" macro: http://board.flatassembler.net/topic.php?p=27020#27020 |
|||
27 Sep 2009, 18:46 |
|
rugxulo 27 Sep 2009, 18:53
Using "undefine" is way more work than just renaming the label.
BTW, there isn't really any ambiguity, esp. when the target is DOS and the keyword is ELF. (Yeah, MOSS and DJELF used ELF, but that's moot here. Well, maybe not, but ....) The real problem is when common words become reserved, that just makes clashes all the more common: "pause", "wait", etc. FASM should know that anything on the start of a line ending with ':' is a label, no? So it can't be a keyword too. |
|||
27 Sep 2009, 18:53 |
|
revolution 30 Sep 2009, 03:40
Tomasz: Perhaps fasm v2 can be smarter in this regard and have context dependant reserved words.
|
|||
30 Sep 2009, 03:40 |
|
Tomasz Grysztar 30 Sep 2009, 07:49
It is a straight consequence of fasm2 design. Because there no longer would be a separation of text processing stage from assembly, the keywords recognition would have to be real-time.
|
|||
30 Sep 2009, 07:49 |
|
alexfru 06 Sep 2015, 23:18
Is there still no workaround to this? FASM could, in theory, treat symbols prefixed with a couple of special characters always as labels or as non-reserved keywords. The issue gets in the way when the assembler is used in a compiler backend and therefore restricts the names of global variables and functions. While my Smaller C compiler by default prefixes every global with an underscore, this isn't quite compatible with ELF/Linux, where it is customary to have no underscores.
|
|||
06 Sep 2015, 23:18 |
|
l_inc 07 Sep 2015, 09:59
alexfru
fasm's syntax is so customizable by means of its preprocessing capabilities, that I fail to see any problem here. Any directive except fix can be redefined. And even fix is only recognized when being the second token on line, so it also can be a label name. Example: Code: ;redefining preprocessor directives macro! fix macro macro fix ^macro struc! fix struc struc fix ^struc define! fix define define fix ^define ;... ;redefining assembly directives and instructions macro! redef! [d*] { define! d#! d define! d ^#d } redef! format, section, mov, jmp ;, ... ;frontend output format! PE GUI 5.1 section! '.text' code readable executable mov! eax,[mov] mov! edx,[macro] format: jmp! format section! '.data' data readable writeable mov dd 0 macro dd 1 _________________ Faith is a superposition of knowledge and fallacy |
|||
07 Sep 2015, 09:59 |
|
Tomasz Grysztar 07 Sep 2015, 10:05
alexfru wrote: Is there still no workaround to this? FASM could, in theory, treat symbols prefixed with a couple of special characters always as labels or as non-reserved keywords. The issue gets in the way when the assembler is used in a compiler backend and therefore restricts the names of global variables and functions. While my Smaller C compiler by default prefixes every global with an underscore, this isn't quite compatible with ELF/Linux, where it is customary to have no underscores. Code: PUBLIC __format AS 'format' EXTRN 'format' AS __format |
|||
07 Sep 2015, 10:05 |
|
revolution 07 Sep 2015, 10:09
I always seem to have trouble with the crc32 instruction. Much code I used in the past has a function called the same. But then Intel came along and decided to make it an instruction name.
|
|||
07 Sep 2015, 10:09 |
|
Tomasz Grysztar 07 Sep 2015, 10:36
BTW, this was an old thread and it did not mention that the pool of reserved words was reduced with 1.69.22 release, since formatter flags and operators are now recognized only in context and are not reserved words anymore.
|
|||
07 Sep 2015, 10:36 |
|
alexfru 10 Sep 2015, 06:10
Thanks, the AS keyword kicks AS! It's a bit disappointing to not have found it in the section devoted to labels (and constants). The section talks about special @@ labels, dot labels, the label directive but fails to even refer to this special case with the global and extrn directives. It would really be nice to have a few references to these other cases (including the $ label), just in the form of "For other special cases/uses of labels see sections X, Y, Z", no need to duplicate the text. I clearly missed this when I was looking for "label" (it appears only once in the COFF and ELF sections). Still, thanks!
|
|||
10 Sep 2015, 06:10 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.