|
@@ -34,12 +34,15 @@ EXPR : EXPR '+' FACTOR {$$ = $1 + $3;}
|
|
|
| FACTOR
|
|
|
;
|
|
|
|
|
|
-FACTOR : number {$$ = $1;}
|
|
|
- | FACTOR '*' FACTOR {$$ = $1 * $3;}
|
|
|
- | FACTOR '/' FACTOR {$$ = $1 / $3;}
|
|
|
- | '(' EXPR ')' {$$ = $2;}
|
|
|
+FACTOR : FACTOR '*' ATOM {$$ = $1 * $3;}
|
|
|
+ | FACTOR '/' ATOM {$$ = $1 / $3;}
|
|
|
+ | ATOM
|
|
|
;
|
|
|
|
|
|
+ATOM : number {$$ = $1;}
|
|
|
+ | '(' EXPR ')' {$$ = $2;}
|
|
|
+ ;
|
|
|
+
|
|
|
%%
|
|
|
#include <stdio.h>
|
|
|
#include "eval.tab.h"
|