Hi, Thanks Laurence for your comments.
> I don't know how C compilers do this, but you could look at how I I think C compilers generate semantic trees, instead of executing the actions, that then are passed to the back-end to emit CPU opcodes. > implemented loops in GNU 3DLDF. It was not particularly difficult. The > basic idea is: Read the loop, put it into a buffer, put code at the end > of the buffer for your conditional and start reading from the buffer Hmm.. So bison is able to read from data buffers instead of a FILE*. How can I achieve that? > > if a given condition isn't met? It's > > typically useful for the "if then else" closure, i.e: > > > > if_stmt: > > IF expr { update(&($2)); } block { reset(); } > > ; > > > > where block won't be parsed/executed if the expr isn't valid. > > I think it's usually not a good idea to execute code in the middle of I agree, but I didn't find another way, yet. Back to for loops, if I'm going to copy my block into a temporary buffer then I'll have to do something similar, i.e executing an action in the middle of a rule, at least to mark the beginning of a block and its end, i.e: block: '{' { begin_marker(); } declarations statements { end_marker(); } '}' ; to save the content of the entire block and re-execute it as long as the condition is valid. Any thoughts? BR, Ilyes Gouta. _______________________________________________ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison