end-of-stream-conflict.opp.exp 248 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11
%start expr
%token <int> INT
%token PLUS
%token TIMES
%left PLUS 
%left TIMES 
%type <int> expr
%%

expr:
| i = INT
12 13 14 15 16
    {    ( i )}
| e1 = expr _2 = PLUS e2 = expr
    {    ( e1 + e2 )}
| e1 = expr _2 = TIMES e2 = expr
    {    ( e1 * e2 )}
17 18 19 20 21

%%