clean up bison file

This commit is contained in:
vel 2024-10-24 11:49:24 -07:00
parent f01cb2ce5b
commit 454a56fc8f
Signed by: velvox
GPG Key ID: 59D9762F674151DF
2 changed files with 1 additions and 14 deletions

View File

@ -43,7 +43,7 @@ UTEST(scanner, hello) {
int index = 0;
token_t t;
do {
printf("index: %d token: %d text: %s\n", index, t, yytext);
// printf("index: %d token: %d text: %s\n", index, t, yytext);
ASSERT_EQ(tokens[index].t, (t = yylex()));
ASSERT_STREQ(tokens[index].p, yytext);
++index;

View File

@ -60,22 +60,9 @@ int yylex();
%token TOKEN_EXPONENTIAL
%%
program : expr TOKEN_SEMI;
expr : expr TOKEN_PLUS term
| expr TOKEN_MINUS term
| term
;
term : term TOKEN_MUL factor
| term TOKEN_DIV factor
| factor
;
factor: TOKEN_MINUS factor
| TOKEN_LPAREN expr TOKEN_RPAREN
| TOKEN_INT
;
%%
void yyerror(const char* msg) {
fprintf(stderr, "Error | Line: %d\n%s\n",yylineno,msg);