Created
July 12, 2016 15:23
-
-
Save andreaferretti/d55f290d32bad11eaba5afd2e476ac5e to your computer and use it in GitHub Desktop.
Nim macro expansion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import macros | |
macro expandMacros(body: stmt): stmt = | |
template inner(x: stmt): stmt = x | |
result = getAst(inner(body)) | |
echo result.toStrLit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://nim-lang.org/docs/macros.html#expandMacros.m%2Ctyped
https://github.com/nim-lang/Nim/blob/version-1-6/lib/core/macros.nim#L1502