diff --git a/nemu/src/monitor/sdb/addrexp.l b/nemu/src/monitor/sdb/addrexp.l index 14deb31..4e225a0 100644 --- a/nemu/src/monitor/sdb/addrexp.l +++ b/nemu/src/monitor/sdb/addrexp.l @@ -7,7 +7,7 @@ %% -$?[a-zA-Z]{2,3} { yylval = isa_reg_str2val(yytext + 1, &success); if(!success) { return YYerror; } } +$[a-zA-Z]{2,3} { yylval = isa_reg_str2val(yytext + 1, &success); if(!success) { return YYerror; } } 0[xX][0-9a-fA-F]+ { yylval = strtoul(yytext, NULL, 16); return HEX_NUMBER; } [0-9]+ { yylval = strtoul(yytext, NULL, 10); return NUMBER; } [+\-*/()] { return *yytext; } diff --git a/nemu/src/monitor/sdb/addrexp.y b/nemu/src/monitor/sdb/addrexp.y index f0ba851..42b9c62 100644 --- a/nemu/src/monitor/sdb/addrexp.y +++ b/nemu/src/monitor/sdb/addrexp.y @@ -6,6 +6,7 @@ } %{ #include + #include #include #include void yyerror(word_t *result, const char *err) { @@ -47,6 +48,6 @@ number | HEX_NUMBER register - : '$' REGISTER { $$ = $2; } + : REGISTER { $$ = $1; } %%