UASM icon indicating copy to clipboard operation
UASM copied to clipboard

Is it possible to add a systematic way to use "potential reserved words" as identifiers?

Open ntysdd opened this issue 3 months ago • 3 comments

For example, nasm has a nice feature -- you can prefix a "$" to an identifier, then it is no longer an reserved word.

In masm it is incrediblely and unreasonably hard to call a function named "add" or "enter".

The "option nokeyword" is hard to use.

And since newer CPUs keep adding new instructions, there is always a risk of conflicts.

ntysdd avatar Oct 08 '25 11:10 ntysdd

Could you not just prefix the thing you want to add which would be a reserved word? - I'm not sure I like the idea of overriding reserved words - it has a bad smell to me and not sure I'd personally go with the NASM version.

I mean you have the same situation in any other language, you can't make a C function called struct() for example .. I kind of think the restriction is there for a good reason, when this happens to me I normally just do something IDENTIFIER or IDENTIFIER etc.

Open to discussion on this though.

john-terraspace avatar Nov 29 '25 17:11 john-terraspace

Regarding this issue, I'm considering using this assembler as a backend assembler for C (or some other language). C's reserved words differ from those in assembly language, making it challenging to handle all reserved words (and new CPUs may continue to introduce new instructions).

ntysdd avatar Nov 30 '25 01:11 ntysdd

I think it's incredibly unlikely that you'd get a collision between new instructions and reserved words, given how bizarre most new instruction mnemonics are :) - it's not impossible though I guess.

I'm not sure how well the symbol and ID lookup system would handle being able to switch these things on/off - I'll have a look at how NOKEYWORD works behind the scenes and see if theres a way to expose it in a more friendly way.

john-terraspace avatar Nov 30 '25 09:11 john-terraspace