BenchGen
BenchGen is a tool for generating benchmarks to stress-test a computing system.
|
The Parser class is responsible for parsing a sequence of tokens and constructing an abstract syntax tree (AST). More...
#include <parser.h>
Public Member Functions | |
Parser () | |
Constructs a Parser object with default values. | |
void | setTokens (std::vector< Token > _tokens) |
Sets the tokens for the parser to process. | |
void | parse () |
Initiates the parsing process and builds the abstract syntax tree (AST). | |
std::shared_ptr< Node > | getAST () |
Returns the root of the abstract syntax tree (AST). | |
The Parser class is responsible for parsing a sequence of tokens and constructing an abstract syntax tree (AST).
The Parser class provides methods to set the tokens, perform the parsing process, and retrieve the resulting AST. It includes private methods for handling various parsing tasks such as matching tokens and parsing different code structures.
|
inline |
Constructs a Parser object with default values.
Initializes the token index, sets the AST to nullptr, and prepares an empty stack to track conditionals and PATH parameters within function calls.
std::shared_ptr< Node > Parser::getAST | ( | ) |
Returns the root of the abstract syntax tree (AST).
Provides access to the root node of the AST, representing the parsed structure of the input code.
void Parser::parse | ( | ) |
Initiates the parsing process and builds the abstract syntax tree (AST).
Starts the parsing process by calling the parse_CODE function, which builds the AST from the provided tokens.
void Parser::setTokens | ( | std::vector< Token > | _tokens | ) |
Sets the tokens for the parser to process.
Initializes the parser's token list with the provided tokens.
_tokens | The vector of tokens to be parsed. |