From e5b1dd03b5bd4ed389daaaa564918c6d92afaf8a Mon Sep 17 00:00:00 2001 From: Riley Smith Date: Tue, 12 Nov 2024 15:41:25 -0800 Subject: [PATCH] test bison --- lab-4/parser.bison | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/lab-4/parser.bison b/lab-4/parser.bison index 0876739..c0c71ca 100644 --- a/lab-4/parser.bison +++ b/lab-4/parser.bison @@ -1,41 +1,14 @@ %{ #define YYDEBUG 1 #include - -#include -#include -#include -#include "expr.h" - -/* -YYSTYPE is the lexical value returned by each rule in a bison grammar. -By default, it is an integer. In this example, we are returning a pointer to an expression. -*/ - -#define YYSTYPE struct expr * - -/* -Clunky: Manually declare the interface to the scanner generated by flex. -*/ - -extern char *yytext; -extern int yylex(); extern int yylineno; void yyerror(const char*); - - -/* -Clunky: Keep the final result of the parse in a global variable, -so that it can be retrieved by main(). -*/ - -struct expr * parser_result = 0; +int yylex(); %} %debug %define parse.error detailed - %token TOKEN_EOF %token TOKEN_KEYWORD_IDENTIFICATION %token TOKEN_KEYWORD_DIVISION @@ -102,6 +75,7 @@ statement : section | data_space | data_declaration ; + section : type TOKEN_KEYWORD_DIVISION TOKEN_DOT | type TOKEN_RUN TOKEN_DOT ;