> compile NEMU

ysyx_22040000 李心杨
Linux calcite 6.1.75 #1-NixOS SMP PREEMPT_DYNAMIC Thu Jan 25 23:27:52 UTC 2024 x86_64 GNU/Linux
 22:37:19  up   4:38,  2 users,  load average: 0.35, 0.17, 0.15
This commit is contained in:
tracer-ysyx 2024-02-05 22:37:19 +08:00 committed by xinyangli
parent 4bb0fb31ae
commit 7cb08dc9fa

View file

@ -1,5 +1,6 @@
%code requires { %code requires {
#include <common.h> #include <common.h>
#include <memory/vaddr.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
extern int yylex(void); extern int yylex(void);
@ -41,6 +42,7 @@ expression
$$ = $1 / $3; $$ = $1 / $3;
} }
| '-' number { $$ = -$2; } | '-' number { $$ = -$2; }
| '*' expression { printf("deref: %u\n", $2); }
| '(' expression ')' { $$ = $2; } | '(' expression ')' { $$ = $2; }
number number