#ifndef _SYSY_DRIVER_H_ #define _SYSY_DRIVER_H_ #include #include #include // Generated by bison: #include "SysYParser.h" #include "SysYFlexLexer.h" // Conducting the whole scanning and parsing of SysY. class SysYDriver { public: SysYDriver(); virtual ~SysYDriver(); std::map variables; int result; // SysY lexer SysYFlexLexer lexer; std::ifstream instream; // Handling the SysY scanner. void scan_begin(); void scan_end(); bool trace_scanning; // Run the parser on file F. // Return 0 on success. SyntaxTree::Node* parse(const std::string& f); // The name of the file being parsed. // Used later to pass the file name to the location tracker. std::string file; // Whether parser traces should be generated. bool trace_parsing; // Error handling. void error(const yy::location& l, const std::string& m); void error(const std::string& m); SyntaxTree::Node* root = nullptr; }; #endif // _SYSY_DRIVER_H_