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

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< TokengetTokens (std::string fileName)
 Gets the tokens from a given file.
 
std::vector< ProductionRulegetProductionRules (std::string fileName)
 Extracts production rules from a given file.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Lexer()

Lexer::Lexer ( )

Constructs a Lexer object and loads the configuration rules.

Member Function Documentation

◆ getProductionRules()

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.

Parameters
fileNameThe path to the file containing production rules.
Returns
A vector of ProductionRules extracted from the file.

◆ getTokens()

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.

Parameters
fileNameThe path to the file from which tokens are to be generated.
Returns
A vector of Tokens extracted from the file.

◆ loadConfiguration()

void Lexer::loadConfiguration ( )

Loads lexer configuration rules.

Initializes the lexer rules with predefined types and regular expressions that will be used for tokenizing input.


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