The problem is determining term:
term: NUMBER | term op term ;
When analyzing this issue, the question arises on each issue: should I read another token to find out if I have the first or second form.
The solution may be to determine:
term: NUMBER reminder;
reminder: /* empty */ | op term;
Grammar, after its adaptation, is as follows:
%token NUMBER
%token COMMA
%token OPERATOR
%left OPERATOR
%left COMMA
%%
term: NUMBER reminder;
reminder: /* empty */ | op term;
op: OPERATOR | COMMA;
%%
compiles without warning using bison (GNU Bison) 2.4.1.
tonio source
share