#ifndef PARSER_H #define PARSER_H #include #include "Token.h" #include "Expression.h" #include "Statement.h" using namespace std; class Parser { private: vector> tokens; int currentIndex = 0; shared_ptr nextStatement(); shared_ptr matchStatementFunctionDeclaration(); shared_ptr matchStatementVarDeclaration(); shared_ptr matchStatementBlock(); shared_ptr matchStatementReturn(); shared_ptr matchStatementExpression(); shared_ptr matchStatementInvalid(); shared_ptr nextExpression(); shared_ptr matchEquality(); // =, != shared_ptr matchComparison(); // <, <=, >, >= shared_ptr matchTerm(); // +, - shared_ptr matchFactor(); // *, /, % shared_ptr matchPrimary(); // integer, () shared_ptr matchExpressionLiteral(); shared_ptr matchExpressionGrouping(); shared_ptr matchExpressionBinary(shared_ptr left); shared_ptr matchExpressionIfElse(); shared_ptr matchExpressionVar(); shared_ptr matchExpressionInvalid(); bool matchesTokenKinds(vector kinds); public: Parser(vector> tokens); vector> getStatements(); }; #endif