If you insist (and I agree with Araq you probably shouldn't ... ), you should probably be aware of [https://nim-lang.org/docs/filters.html](https://nim-lang.org/docs/filters.html) which would allow you to do such a translation in a standard, compose-able manner -- which may boil down to just replacing "def" with "proc".
I am not sure if it will work for your specific use case, but some macros/pragmas could be set for a context (once in the file, or a block, essentially - see e.g. [https://nim-lang.org/docs/manual.html#pragmas-push-and-pop-pragmas](https://nim-lang.org/docs/manual.html#pragmas-push-and-pop-pragmas)) , and there are other ways to apply a macro to a block of definitions rather than to a specific one through the `{.pragma.}` syntax - e.g. > dspcode: > proc foo(args:) ... > .... Where dspcode is a macro that does the magic onto it's subtree. What's left is just the proc<->def exchange.
