mymacro:
submacro1:
...
submacro2:
...
submacro3:
(here I might need references to identfiers created in submacro1)
Any project (simple) that I might look for inspiration?
If you want to split a big macros in multiple macros the easiest way to do that is to use a var MyTable: Table[string, NimNode] {.compileTime.} that will collect code fragment from one macro to another.
Simple example to transfer data between 2 macros when a seq suffices at:
More complex but still simple example: https://github.com/mratsim/Synthesis/blob/b8fdd103/synthesis/factory.nim#L77 All macros are updating the Registry object and the one that does the final code generation just read from it this way there is no interleaving.
Maybe I should call that the Registry pattern.