On 12 Sep 2005, at 23:31, Baldurien (club internet) wrote:
I've made a little parser in PHP based on bison output file, and I experiment a little problem : When I have to reduce, saying by rule X : Y '+' X I know I have to pop 3 times, but what happens when the rule is simply X : /* empty */ ? I can't pop at all, so what should I do?
Just don't pop. If s is the state on top of the state stack, the total effect is that the state goto(s, X) is pushed onto it. If you have a stack for non-terminals and terminals, which the Bison generated parser doesn't, then X will be pushed onto that. The rule action is executed.
Hans Aberg _______________________________________________ Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison