flat assembler
Message board for the users of flat assembler.

Index > IDE Development > fasmg syntax support scripts and test suit

Author
Thread Post new topic Reply to topic
bitRAKE



Joined: 21 Jul 2003
Posts: 4425
Location: vpcmpistri
bitRAKE 09 Apr 2026, 03:20
https://github.com/bitRAKE/fasmg_syntax

There is much nuance to fasmg syntax to account for when trying to integrate the language into various systems. For better or worse I've collected much of the details into one place with scripts that create syntax configurations for: NPP (UDL), TextMate, ...

Some success has been seen in present work, but testing every editor is beyond my ability. Tomasz might even be shocked by some valid syntax, but at least it's covered explicitly.

If you're trying to implement fasmg syntax this is probably a good place to continue after the manuals, imho.

_________________
¯\(°_o)/¯ AI may [not] have aided with the above reply.
Post 09 Apr 2026, 03:20
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8524
Location: Kraków, Poland
Tomasz Grysztar 09 Apr 2026, 08:44
Excellent work! I skimmed through the notes and they seem well-researched and correct. I noticed one that requires clarification, though:
Quote:
# is the concatenation / context-break marker. It can appear anywhere inside an identifier (including leading or trailing) without changing the meaning; when placed between two name tokens it forces them to concatenate (and resets the recognition context to the current one).
The "#" does not reset anything, the other parts of identifier still have the context info they had. Think of it a kind of rich text, with invisible "color" applied to some of the tokens. The snippets of text you carry around in variables/parameters keep the "color" corresponding to their context and the only way to remove it is with RAWMATCH (which gives a result similar as if you converted the tokens to string and then passed the string through EVAL again).

However, for symbol identification purposes the assembler only uses the context that applies to the first token of the identifier. The coloring of the subsequent tokens does not matter. This is why inserting "#" right at the start of the identifier forces it to be interpreted in context valid for this "#" character, which is usually the current context. It is the color of "#" character itself that matters.

BTW, the whitespace-sensitivity of identifiers is there to provide compatibility with fasm 1, which had "." and "?" as non-special characters that could be used in names. Thus fasmg's identifiers, even though they may consist of multiple tokens, correspond to fasm's single-token names. And whitespace-sensitivity is crucial to distinguish things like "db?" and "db ?" in fasm-compatible way. And the concatenation operator forbidding the whitespace allows things like #-prefixed literals that some assembly dialects use, with an important distinction being "db#1" vs "db #1".
Post 09 Apr 2026, 08:44
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4425
Location: vpcmpistri
bitRAKE 09 Apr 2026, 18:30
Thank you.

Ideally, I'd start with the first version of fasmg and gather test cases through the versions. Then the python script would execute the tests applicable for the version. I don't have time for that curation at the moment nor do I think it that useful. The better approach is probably to make the version commit based, but that ties the information to git.

Most highlighting is quite "surface" - something like Tree-Sitter would be need to express the dynamics of potential fasmg source -- to get the kind of intellisense that some people desire.

_________________
¯\(°_o)/¯ AI may [not] have aided with the above reply.
Post 09 Apr 2026, 18:30
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8524
Location: Kraków, Poland
Tomasz Grysztar 10 Apr 2026, 10:11
I also see your notes as an alternative reference material for fasmg syntax, and this is a very valuable resource. It is great to have high-quality alternatives to the official manual, even if they just rephrase the same information. If anyone has doubts when reading what I wrote, if they find something not explained enough, they can cross-check with alternative references like the one you made, and having the same information expressed differently by different authors allows for more clarity.

bitRAKE wrote:
Ideally, I'd start with the first version of fasmg and gather test cases through the versions. Then the python script would execute the tests applicable for the version. I don't have time for that curation at the moment nor do I think it that useful. The better approach is probably to make the version commit based, but that ties the information to git.
Old versions often mean dealing with bugs and personally I think it would be a waste of resources. Especially since fasm2 requires features that were added relatively recently.

bitRAKE wrote:
Most highlighting is quite "surface" - something like Tree-Sitter would be need to express the dynamics of potential fasmg source -- to get the kind of intellisense that some people desire.
In the extreme this might be an irreducible problem. That is, you would probably need to reproduce the entire assembly process to see exactly how the portions of the text end up interpreted. I would not chase the perfection here, a simple ruleset already covers the usual cases.
Post 10 Apr 2026, 10:11
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2026, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.