Macros using "expanded variables" ================================= Goals: * Macros should be local to the block they are defined in (and if defined at top level, they should be local to the file they are defined in) - This means that they cannot generate top-levels! * Macros should be defined before use * Syntax and semantic checks should happen BEFORE the macros are expanded. The only thing that should happen after expansion is IR generation (and machine code generation and exec/lib file output). - This might be tricky with Alternative 1 (below). For the switch with case values, there should be a check whether the switch handles all values, for example Alternative 1: func test() { switch tok { %for %t in [newline, kw_if, kw_else] { case %t { ... } } } } Alternative 2: * Use "subcase" for switch/case * Add a special syntax for data definitions (see table_generation_and_macros.txt) func test() { switch tok { case newline, kw_if, kw_else { ... subcase newline { ... } ... print(tok.name()) ... } } }