flat assembler
Message board for the users of flat assembler.

Index > Programming Language Design > Alternative syntax for RESTORE?

Author
Thread Post new topic Reply to topic
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8359
Location: Kraków, Poland
Tomasz Grysztar 06 Oct 2017, 18:12
I decided to present, in a form of stream of thought, some of my ideas for tweaks in syntax of fasm (both g and 1, as many of their syntactical choices overlap) that have been haunting me for years but I never included them in the assemblers as I never really liked the syntax options I was coming up with.

There never was any urgency in implementing these ideas, since they are not really crucial. They could make macro development easier in some specific cases, but any problems they solve can usually be solved some other way. I present them mainly to preserve the thoughts, though we could also discuss what could be done to make the syntax more appealing. Or perhaps you would like it more that I do?

It starts with this: fasmg, just like the preprocessor of fasm 1, has separate directives for removing the most recent value of symbols of various classes. RESTORE is for the expression-class, PURGE for instructions, and RESTRUC for labeled instructions (structures).

I've been sometimes considering additional syntactical features for RESTORE directive that would allow it to restore instructions. It could look like:
Code:
restore db, :db, /db
; equivalent to:
restore db
purge db
restruc db    
This could be easily made into a macro. But if such syntax was officially introduced in one internal directive, it could as well be used in others. An example follows.

Another feature that I keep reconsidering is the IFDEF/IFNDEF directive. Such directive could be useful even if applied just to the expression-class symbols, because IF DEFINED construction does not allow to check for symbolic variables, neither in fasmg nor in fasm 1, as in both the assemblers symbolic variables are replaced with their values before the condition that is an argument to IF is evaluated.

If for this reason I decided to add IFDEF/IFNDEF, a logical extension of this idea would be allow to check for definitions of macroinstructions and structures. One way to do it would be to add more directives, like IFDEFI, IFDEFS, etc. But if there already existed a syntax for RESTORE like described above, it could also be adapted to IFDEF. And then
Code:
idef :mov    
would check whether there is a macro named "mov".
Post 06 Oct 2017, 18:12
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20451
Location: In your JS exploiting you and your system
revolution 06 Oct 2017, 18:53
The symbols : and / are not intuitive. I would have to look them up each time I read code with them or want to write code for them.
Post 06 Oct 2017, 18:53
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8359
Location: Kraków, Poland
Tomasz Grysztar 06 Oct 2017, 18:57
revolution wrote:
The symbols : and / are not intuitive. I would have to look them up each time I read code with them or want to write code for them.
Yes, that's one of the reasons why I never really pursued implementing these ideas, every syntax I could come up with had some flaws. A separate and descriptive directive names may actually have been the only right choice. Though unlike RESTRUC, PURGE is not descriptive enough IMO, it was only chosen for a "partial compatibility" with some old assemblers that used it in this meaning.
Post 06 Oct 2017, 18:57
View user's profile Send private message Visit poster's website Reply with quote
_shura



Joined: 22 May 2015
Posts: 61
_shura 07 Oct 2017, 17:36
I prefer a more descriptive notation and not such a notation, where I could not easily spell the code, if I had to (That is why I am rather use Intel-syntax than AT&T-syntax). What about another directive like:
Code:
killall mov, db ;, ...    
Post 07 Oct 2017, 17:36
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8359
Location: Kraków, Poland
Tomasz Grysztar 07 Oct 2017, 18:47
I usually do not consider adding directives that can be implemented as a simple macro using the existing ones. The above considerations are only because it could be a different syntax instead of the one requiring multiple directive names.
Post 07 Oct 2017, 18:47
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.