added return parsing

This commit is contained in:
Karma Riuk
2025-07-07 18:33:39 +02:00
parent 1638ddbfa1
commit 0b9d7d9c33
3 changed files with 42 additions and 0 deletions

View File

@@ -51,6 +51,17 @@ namespace parser {
return false;
}
ast::return_stmt* parser::parse_return() {
ast::return_stmt* stmt = new ast::return_stmt(current);
next_token();
// TODO: we are currently skipping expressions until we encounter a
// semicolon
for (; current.type != token::type::SEMICOLON; next_token()) {}
return stmt;
}
ast::let_stmt* parser::parse_let() {
ast::let_stmt* stmt = new ast::let_stmt(current);