boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

13-parenless.M1pp (810B)


      1 # Paren-less 0-arg macro calls:
      2 #  - a zero-param macro invoked without trailing () expands the same as with ()
      3 #  - applies at top level and as an atom inside %(...) expressions
      4 #  - non-zero-param macros still require their (arg, ...) syntax — %add1
      5 #    without parens must pass through unchanged
      6 #  - a %foo where foo is not a macro still passes through unchanged
      7 
      8 %macro FRAME_BASE()
      9 16
     10 %endm
     11 
     12 %macro add1(x)
     13 %((+ x 1))
     14 %endm
     15 
     16 # Top-level: both forms yield `16`.
     17 %FRAME_BASE
     18 %FRAME_BASE()
     19 
     20 # Expression atom: both yield 4-byte LE hex for 24 (16 + 8).
     21 %((+ %FRAME_BASE 8))
     22 %((+ %FRAME_BASE() 8))
     23 
     24 # Undefined %foo passes through unchanged.
     25 %foo
     26 
     27 # Param-ful macro without parens does NOT match — literal text flows through.
     28 %add1
     29 
     30 # Param-ful macro with proper call still works (sanity).
     31 %add1(41)
     32 END