> compile NEMU

ysyx_22040000 李心杨
Linux calcite 6.1.69 #1-NixOS SMP PREEMPT_DYNAMIC Wed Dec 20 16:00:29 UTC 2023 x86_64 GNU/Linux
 02:55:41  up 1 day  3:11,  2 users,  load average: 0.95, 0.77, 0.65
This commit is contained in:
tracer-ysyx 2024-01-13 02:55:41 +08:00 committed by xinyangli
parent 70ec0a166a
commit b97e2bf469
4 changed files with 60 additions and 43 deletions

View file

@ -21,13 +21,13 @@ input
;
expression
: expression '+' expression { $$ = $1 + $3; }
: number { $$ = $1; }
| expression '+' expression { $$ = $1 + $3; }
| expression '-' expression { $$ = $1 - $3; }
| expression '*' expression { $$ = $1 * $3; }
| expression '/' expression { $$ = $1 / $3; }
| '-' number { $$ = -$2; }
| '(' expression ')' { $$ = $2; }
| number { $$ = $1; }
number
: NUMBER