Yet another macro DSL

2021-11-14 Thread PMunch
That was part of the idea behind [`macroutils`](https://github.com/PMunch/macroutils). It doesn't set default arguments, but it creates procedures to create the various kinds of Nim nodes in a simplified way. You also have setters like e.g. `left` and `right` for infix nodes and `body`, `pragma

Yet another macro DSL

2021-11-14 Thread planetis
Nice! Have you looked at [fusion/astdsl](https://nim-lang.github.io/fusion/src/fusion/astdsl.html) btw?

Yet another macro DSL

2021-11-14 Thread rb3
Did you mean a higher-level API than ASTs? Maybe I can make a separate library for that, but this one is meant to reflect the output of `treeRepr`, so it follows Nim's abstract syntax tree representation closely. This is basically just sugar over normal `newTree` and `newNimNode` calls from `std

Yet another macro DSL

2021-11-14 Thread kobi
nice, but perhaps it's possible to have default arguments as Empty, and just call a nice api where you don't have to specify those? (in other words, don't rely on argument order etc, but show a high level api)

Yet another macro DSL

2021-11-14 Thread rb3
If anyone was looking for yet another DSL for writing macros, here is a crappy one I just finished refactoring: . Sample usage: import mast macro makeMain(body: untyped) = ast: ProcDef: `main` Empty