On 2013-12-04 03:23:59 +0000, bearophile said:


Joshua Niehus:


This would make for a good blog post/wiki article.  Does one already exist?


If you have a AST macros like in Julia language, I think you can write something like:


@setExpr(a (b c));


The main difference is that the compiler gives you a tree in the macro to work on, instead of a string to parse and munge.


Bye,

bearophile


Can't you define


template setExpr(string expr)

{

PeggedStuff...


mixin(PeggedStuff());

}


setExpr!(q{a (b c)}); ?


-Shammah