开发者

bison calculator problem

开发者_开发问答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 ?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜