Matthias Kramm wrote:

I'll probably define myself some C macros so that I can at least
write something like
    E = E '+' E {pass2only append($1);append($3);append(OP_ADD);}
.
But it would of course be more nifty if the default behaviour "execute an action only if the pass is 2" could be placed
somewhere central.

You really want a bison equivalent of flex's YY_USER_ACTION, but I don't think there is one. You could hack the bison output if you're desperate - maybe something in/around YY_REDUCE_PRINT.

Any pointers to a pure C AST implementation, by any chance?

There's a C runtime for Antlr, so I guess all the AST code has C versions as well - I don't think it existed when I needed it. The C++ version has ~80 .hpp and .cpp files for the AST bits (I think I found it in a lib directory somewhere in the source tree).

-Evan


_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to