Hello,
i saw some undocumented Headers in the Docu, that lead to the following question:
With best regards,
enurlyx
If you want to get the AST produced by another macro, you can use the getAst magic from the macros module. It will work for both macros and templates. If you don't use getAst and call another macro directly, you'll just get its code expanded in the body of the caller macro just as if it was a regular proc.
It's possible to create macros from macros, you just need to return a nkMacroDef definition as part of your resulting AST. Most of the time this would be done with templates - see this wicked example from the unittest module: https://github.com/Araq/Nimrod/blob/71b5b6c0261546f8c2a42e1a4f6d264c7727a7a6/lib/pure/unittest.nim#L46
The main difference between Nimrod and Lisp when it comes to macros is that Nimrod has a type system, which fully interacts with the macro system (i.e. you get regular overloading, the ability to specify precise input types, etc), but requires you to learn quite a bit more complicated representation of the code - The Nimrod grammar consists of many different AST node types, while in Lisp everything is represented as lists (s-exprs). Depending on your lisp, we may also have more features regarding symbol lookup rules and hygiene for the generated code. Nimrod's term rewriting macros are also something that is generally not available in Lisp.