From 454a56fc8f3720b0976adfc246815fd96787fa42 Mon Sep 17 00:00:00 2001 From: Riley Smith Date: Thu, 24 Oct 2024 11:49:24 -0700 Subject: [PATCH] clean up bison file --- lab-3/main_test.c | 2 +- lab-4/parser.bison | 13 ------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/lab-3/main_test.c b/lab-3/main_test.c index ac25b7e..e2aa6a9 100644 --- a/lab-3/main_test.c +++ b/lab-3/main_test.c @@ -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; diff --git a/lab-4/parser.bison b/lab-4/parser.bison index 6d1a7f6..451e66c 100644 --- a/lab-4/parser.bison +++ b/lab-4/parser.bison @@ -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);