flat assembler
Message board for the users of flat assembler.

Index > Programming Language Design > basic macro compiler

Author
Thread Post new topic Reply to topic
fasmFUN



Joined: 25 May 2019
Posts: 15
fasmFUN 15 Oct 2019, 16:27
hey all.
i super newb in macro assembler
and i would like your help
if it is possible to write macros for complicated expressions in HLA/FASM
for example, macro that can convert the following to HLA/FASM:
a = mid(a,1+sin(a+b*2),10)


(note: mid and sin are predefined functions)

i ask that because i saw some compilers that use this concept
(purebasic, masmBasic for example),
but i don't know how and if macros can handle complicated expressions.


thanks in advanced.
Post 15 Oct 2019, 16:27
View user's profile Send private message Reply with quote
fasmFUN



Joined: 25 May 2019
Posts: 15
fasmFUN 17 Oct 2019, 18:48
someone ?
Post 17 Oct 2019, 18:48
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4352
Location: Now
edfed 18 Oct 2019, 08:09
i think the short answer is no.
but it is very possible to create an expression evaluator.

maybe you can look in the fasm source code to see how it's implemented by TG.
Post 18 Oct 2019, 08:09
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: 20422
Location: In your JS exploiting you and your system
revolution 22 Oct 2019, 12:41
I think the longer answer is that you probably can. But it would be a lot of work.

fasm isn't really meant to be an HLL compiler, so such things like arbitrary expression evaluation aren't very easy to implement. It kind of goes against the basic nature of what assemblers do.
Post 22 Oct 2019, 12:41
View user's profile Send private message Visit poster's website Reply with quote
fasmFUN



Joined: 25 May 2019
Posts: 15
fasmFUN 17 Oct 2020, 16:22
revolution wrote:
It kind of goes against the basic nature of what assemblers do.

only the primitives one
Post 17 Oct 2020, 16:22
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20422
Location: In your JS exploiting you and your system
revolution 18 Oct 2020, 03:36
fasmFUN wrote:
revolution wrote:
It kind of goes against the basic nature of what assemblers do.

only the primitives one
If you make an "advanced" assembler, then it isn't an assembler any more. It becomes an HLL.

If that is what you want, then by all means make one. But you will confuse everyone if you try to call is an assembler.


Last edited by revolution on 19 Oct 2020, 02:49; edited 1 time in total
Post 18 Oct 2020, 03:36
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4060
Location: vpcmpistri
bitRAKE 19 Oct 2020, 01:46
You're not the first to have such a desire:
https://board.flatassembler.net/topic.php?t=17343

The user of that post also went by other handles and has similar work on this board.

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 19 Oct 2020, 01:46
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.