Skip to content

Instantly share code, notes, and snippets.

@samdmarshall
Last active May 29, 2017 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samdmarshall/7cb67d131893c87683a2d6581390c18b to your computer and use it in GitHub Desktop.
Save samdmarshall/7cb67d131893c87683a2d6581390c18b to your computer and use it in GitHub Desktop.
Hint: used config file '/usr/local/Cellar/nim/0.17.0/nim/config/nim.cfg' [Conf]
Hint: used config file '/Users/Samantha/.config/nim.cfg' [Conf]
Hint: system [Processing]
Hint: demo [Processing]
Hint: macros [Processing]
demo.nim(7, 6) Warning: a [b] will be parsed as command syntax; spacing is deprecated [Deprecated]
StmtList(CurlyExpr(Ident(!"foo"), Ident(!"bar")))
clang -c -w -I/usr/local/Cellar/nim/0.17.0/nim/lib -o /Users/Samantha/Projects/snippets/nim-macros/nimcache/demo.o /Users/Samantha/Projects/snippets/nim-macros/nimcache/demo.c
Hint: clang -o /Users/Samantha/Projects/snippets/nim-macros/demo /Users/Samantha/Projects/snippets/nim-macros/nimcache/demo.o /Users/Samantha/Projects/snippets/nim-macros/nimcache/stdlib_system.o /Users/Samantha/Projects/snippets/nim-macros/nimcache/stdlib_macros.o -ldl [Exec]
Hint: operation successful (11852 lines compiled; 0.335 sec total; 17.938MiB peakmem; Debug Build) [SuccessX]
[GC] total memory: 18808832
[GC] occupied memory: 18010112
[GC] stack scans: 802
[GC] stack cells: 1868
[GC] cycle collections: 0
[GC] max threshold: 0
[GC] zct capacity: 1024
[GC] max cycle table size: 0
[GC] max pause time [ms]: 0
[GC] max stack size: 48112
import macros
macro dsl(body: untyped): untyped =
echo lispRepr(body)
dsl:
foo {
bar
}
@samdmarshall
Copy link
Author

My expectation is that the returned lispRepr would be StmtList(Ident(!"foo"), CurlyExpr(Ident(!"bar"))), but instead comes out as StmtList(CurlyExpr(Ident(!"foo"), Ident(!"bar"))).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment