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 ;