Files
interpreter-cpp/src/parser/parser.hpp
Karma Riuk 08aacf0416 extracted the parsing of the "expressions" to it's
own function so we can just modify that once we
get there
2025-07-08 09:50:41 +02:00

31 lines
759 B
C++

#pragma once
#include "ast/ast.hpp"
#include "ast/errors/error.hpp"
#include "ast/statements/let.hpp"
#include "ast/statements/return.hpp"
#include "lexer/lexer.hpp"
#include "token/token.hpp"
namespace parser {
struct parser {
parser(lexer::lexer& lexer);
~parser();
std::vector<ast::error::error*> errors;
ast::program* parse_program();
private:
lexer::lexer& lexer;
token::token current, next;
void next_token();
ast::statement* parse_statement();
ast::expression* parse_expression();
ast::let_stmt* parse_let();
ast::return_stmt* parse_return();
bool expect_next(token::type);
void next_error(token::type);
};
} // namespace parser