BenchGen
BenchGen is a tool for generating benchmarks to stress-test a computing system.
Loading...
Searching...
No Matches
Parser Class Reference

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< NodegetAST ()
 Returns the root of the abstract syntax tree (AST).
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Parser()

Parser::Parser ( )
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.

Member Function Documentation

◆ getAST()

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.

Returns
A shared pointer to the root node of the AST.

◆ parse()

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.

◆ setTokens()

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.

Parameters
_tokensThe vector of tokens to be parsed.

The documentation for this class was generated from the following files: