flat assembler
Message board for the users of flat assembler.
Index
> Programming Language Design > fasmg macro parameters and braces |
Author |
|
revolution 14 Oct 2016, 05:45
jmg wrote: Not sure how easy that is to fix... |
|||
14 Oct 2016, 05:45 |
|
jmg 14 Oct 2016, 06:23
revolution wrote: ... By forcing implicit brackets you also reduce potential functionality. Notice I said 'anywhere the param is used in any expression, the braces are treated as implicit.' - by doing that, you should not lose any functionality, but you DO remove a nasty source of bugs. |
|||
14 Oct 2016, 06:23 |
|
revolution 14 Oct 2016, 06:38
jmg wrote: Notice I said 'anywhere the param is used in any expression, the braces are treated as implicit.' - by doing that, you should not lose any functionality ... There are alternative uses where forcing implicit evaluation will make the code fail. Consider the following where "op" is forced to evaluate first: Code: macro something op db 3 op 4 end macro something + something - something * jmg wrote: but you DO remove a nasty source of bugs. |
|||
14 Oct 2016, 06:38 |
|
jmg 14 Oct 2016, 08:46
revolution wrote: ... I'm not following your example, as I said "used in any expression", not "forcing implicit evaluation" Your example would work fine, under my suggested rules. |
|||
14 Oct 2016, 08:46 |
|
Tomasz Grysztar 14 Oct 2016, 10:30
jmg wrote:
Another example is the "ns" operand in x86 macros: Code: macro x86.parse_operand_value ns,op ; ... ns.size = (ns.imm metadata 1) metadata 1 - x86.reg ; ... One might also argue, that if we were to add (during the expression parsing) implicit brackets around values that originated from parameters, we should also do the same for symbolic variables, since this is an analogous problem (see the example with "symbolic equ 2 + 2" in the manual). But then the tricks like the one with "define SUFF" that I proposed for your Parallax macros would no longer work. fasm and fasmg rely on the principle of emergent language (what I once called "complex solutions with simple features") - the features of the assembler itself aim to be simple and sharply defined, so when you know in detail what each one of them does, you should be able to combine them into complex constructions in a plethora of different ways, often even some that were not envisioned initially when these features were designed. The consequence of this principle is that anything that is not one of these simple building blocks is then implemented in form of macros and this is how the philosophy of fasmg was born. |
|||
14 Oct 2016, 10:30 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.