ysyx-workbench/nemu/src/monitor/sdb/addrexp.l
tracer-ysyx 7ccd5d8e83 > compile NEMU
ysyx_22040000 李心杨
Linux calcite 6.1.71 #1-NixOS SMP PREEMPT_DYNAMIC Fri Jan  5 14:18:41 UTC 2024 x86_64 GNU/Linux
 16:27:37  up 2 days  5:22,  2 users,  load average: 0.21, 0.59, 0.70
2024-01-15 16:27:37 +08:00

14 lines
357 B
Text

%{
#include <addrexp.h>
%}
%option noyywrap
%%
$[a-zA-Z] { }
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; }
[ \t] { }
. { printf("Unexpected character: %s\n", yytext); }
%%