/* PIA - Lenguajes Modernos de Programación * FACULTAD DE CIENCIAS FÍSICO MATEMÁTICAS * Luis Sebastián Martínez Vega - LCC */ #ifndef PARSER_H #define PARSER_H #include #include #include "expressions.hpp" #include "lexer.hpp" class Parser{ private: std::string text; Lexer tokenizer; std::vector tree_stack; Token var{nil, "{}"}; void panic(); Expression *popStack(); Expression *newTree(token_type type); void setText(std::string text); void parseExpr(); void parsePrimeExpr(); void parseTerm(); void parsePrimeTerm(); void parsePower(); void parsePrimePower(); void parseFactor(); bool checkToken(); // Checa el token actual del lexer. public: Expression *parse(std::string expr); }; #endif /* PARSER_H */