boot2

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

014-str-builtin.M1pp (488B)


      1 # %str stringification builtin.
      2 #  - %str(IDENT) wraps the identifier text in double quotes, producing
      3 #    a TOK_STRING.
      4 #  - At emission, every TOK_STRING (whether hand-written or built by
      5 #    %str) decodes into raw bytes, so `%str(hello)` and `"hello"`
      6 #    yield identical output (`68 65 6C 6C 6F`).
      7 
      8 %macro quoteit(name)
      9 %str(name)
     10 %endm
     11 
     12 %quoteit(hello)
     13 %quoteit(foo_bar)
     14 %quoteit(a)
     15 
     16 # Control: hand-written literals must match the macro-generated form.
     17 "hello"
     18 "foo_bar"
     19 "a"
     20 END