Reputation: 716
stmt : expr {printf("%d\n",$1);}
;
expr : expr '+' expr {$$ = $1 + $3;}
| expr '-' expr {$$ = $1 - $3;}
| INTEGER {$$ = $1;}
;
When is the stmt non terminal being executed by bison. When it sees which character ?
Upvotes: 0
Views: 290
Reputation: 34642
Assuming, these are all the rules from your bison input, the nonterminal symbol stmt
gets "executed" as soon as EOF
is reached (i.e.: no further input and the last expr
has been reduced).
However, there are conflicts in your grammar.
Upvotes: 1