BenchGen
BenchGen is a tool for generating benchmarks to stress-test a computing system.
|
The Lexer class is responsible for reading input, applying lexer rules, and generating tokens from the input. More...
#include <lexer.h>
Public Member Functions | |
Lexer () | |
Constructs a Lexer object and loads the configuration rules. | |
void | loadConfiguration () |
Loads lexer configuration rules. | |
std::vector< Token > | getTokens (std::string fileName) |
Gets the tokens from a given file. | |
std::vector< ProductionRule > | getProductionRules (std::string fileName) |
Extracts production rules from a given file. | |
The Lexer class is responsible for reading input, applying lexer rules, and generating tokens from the input.
The Lexer class provides methods to load configuration rules, tokenize input strings, and generate production rules from files.
Lexer::Lexer | ( | ) |
Constructs a Lexer object and loads the configuration rules.
std::vector< ProductionRule > Lexer::getProductionRules | ( | std::string | fileName | ) |
Extracts production rules from a given file.
Reads a file, tokenizes its content, and extracts production rules defined in the file.
fileName | The path to the file containing production rules. |
std::vector< Token > Lexer::getTokens | ( | std::string | fileName | ) |
Gets the tokens from a given file.
Reads the content of a file and tokenizes each line to generate a vector of tokens.
fileName | The path to the file from which tokens are to be generated. |
void Lexer::loadConfiguration | ( | ) |
Loads lexer configuration rules.
Initializes the lexer rules with predefined types and regular expressions that will be used for tokenizing input.