-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
michael.burzan
committed
Dec 27, 2024
1 parent
12bf451
commit 1cb3e2f
Showing
10 changed files
with
346 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#ifndef PALLADIUM_PARSER_H | ||
#define PALLADIUM_PARSER_H | ||
#include <optional> | ||
#include "Lexer.h" | ||
#include <string> | ||
|
||
using AstNode = bool; | ||
|
||
class Parser { | ||
public: | ||
Parser(const std::string& code); | ||
|
||
auto parse() -> bool; | ||
|
||
private: | ||
auto parse_translation_unit() -> AstNode; | ||
auto parse_function() -> AstNode; | ||
auto parse_statements() -> AstNode; | ||
auto parse_statement() -> AstNode; | ||
auto parse_variable_declaration() -> AstNode; | ||
auto parse_constant_declaration() -> AstNode; | ||
auto parse_loop() -> AstNode; | ||
auto parse_return_statement() -> AstNode; | ||
auto parse_expression() -> AstNode; | ||
auto parse_array_initialization() -> AstNode; | ||
auto parse_binary_expression() -> AstNode; | ||
auto parse_condition() -> AstNode; | ||
auto parse_operator() -> AstNode; | ||
auto parse_type() -> AstNode; | ||
|
||
auto accept(TokenKind tk) -> bool; | ||
|
||
private: | ||
Lexer _lexer; | ||
Token _current_token; | ||
Token _last_token; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.