> 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
 10:36:30  up 1 day 10:52,  2 users,  load average: 0.74, 0.65, 0.56
This commit is contained in:
tracer-ysyx 2024-01-13 10:36:30 +08:00 committed by xinyangli
parent 973429f199
commit c74f692289

View file

@ -25,7 +25,13 @@ expression
| expression '+' expression { $$ = $1 + $3; }
| expression '-' expression { $$ = $1 - $3; }
| expression '*' expression { $$ = $1 * $3; }
| expression '/' expression { if($3 == 0) { fprintf(stderr, "Devide by zero at %u / %u\n", $1, $3); YYABORT; }; $$ = $1 / $3;}
| expression '/' expression {
if($3 == 0) {
fprintf(stderr, "Error: divide by zero at %u / %u\n", $1, $3);
YYABORT;
};
$$ = $1 / $3;
}
| '-' number { $$ = -$2; }
| '(' expression ')' { $$ = $2; }