LL1Checker 3.0
“Tool for verifying LL(1) grammars and validating input strings.”
Loading...
Searching...
No Matches
symbol_table Struct Reference

Static Public Member Functions

static void PutSymbol (const std::string &identifier, const std::string &regex)
 Adds a terminal symbol with its associated regex to the symbol table.
 
static void PutSymbol (const std::string &identifier)
 Adds a non-terminal symbol to the symbol table.
 
static bool In (const std::string &s)
 Checks if a symbol exists in the symbol table.
 
static bool IsTerminal (const std::string &s)
 Checks if a symbol is a terminal.
 
static std::string GetValue (const std::string &terminal)
 Retrieves the regex pattern for a terminal symbol.
 
static void Debug ()
 Prints all symbols and their properties in the symbol table.
 
static void SetEol (const std::string &eol)
 Sets the end-of-line symbol.
 

Static Public Attributes

static std::string EOL_ {"$"}
 End-of-line symbol used in parsing, initialized as "$".
 
static std::string EPSILON_ {"EPSILON"}
 Epsilon symbol, representing empty transitions, initialized as "EPSILON".
 
static std::unordered_map< std::string, std::pair< symbol_type, std::string > > st_ {{EOL_, {TERMINAL, EOL_}}, {EPSILON_, {TERMINAL, EPSILON_}}}
 Main symbol table, mapping identifiers to a pair of symbol type and its regex.
 
static std::unordered_map< std::string, unsigned long > token_types_
 Token types, mapping each symbol to a unique integer ID.
 
static std::unordered_map< unsigned long, std::string > token_types_r_
 Reverse mapping from integer token IDs back to symbols.
 
static std::vector< unsigned long > order_ {1}
 Tracks insertion order of token types.
 
static unsigned long i_ {2}
 Current index for assigning new token IDs, starting from 2.
 

Member Function Documentation

◆ Debug()

void symbol_table::Debug ( )
static

Prints all symbols and their properties in the symbol table.

Outputs the symbol table for debugging purposes.

◆ GetValue()

std::string symbol_table::GetValue ( const std::string & terminal)
static

Retrieves the regex pattern for a terminal symbol.

Parameters
terminalTerminal symbol identifier.
Returns
Regex pattern associated with the terminal symbol.

◆ In()

bool symbol_table::In ( const std::string & s)
static

Checks if a symbol exists in the symbol table.

Parameters
sSymbol identifier to search.
Returns
true if the symbol is present, otherwise false.

◆ IsTerminal()

bool symbol_table::IsTerminal ( const std::string & s)
static

Checks if a symbol is a terminal.

Parameters
sSymbol identifier to check.
Returns
true if the symbol is terminal, otherwise false.

◆ PutSymbol() [1/2]

void symbol_table::PutSymbol ( const std::string & identifier)
static

Adds a non-terminal symbol to the symbol table.

Parameters
identifierName of the non-terminal symbol.

◆ PutSymbol() [2/2]

void symbol_table::PutSymbol ( const std::string & identifier,
const std::string & regex )
static

Adds a terminal symbol with its associated regex to the symbol table.

Updates the token type mappings and tracks insertion order.

Parameters
identifierName of the terminal symbol.
regexRegular expression representing the terminal symbol.

◆ SetEol()

void symbol_table::SetEol ( const std::string & eol)
static

Sets the end-of-line symbol.

Parameters
eolString to use as the new end-of-line symbol.

Member Data Documentation

◆ token_types_

std::unordered_map<std::string, unsigned long> symbol_table::token_types_
inlinestatic
Initial value:
{
{EOL_, 1}}
static std::string EOL_
End-of-line symbol used in parsing, initialized as "$".
Definition symbol_table.hpp:11

Token types, mapping each symbol to a unique integer ID.

◆ token_types_r_

std::unordered_map<unsigned long, std::string> symbol_table::token_types_r_
inlinestatic
Initial value:
{
{1, EOL_}}

Reverse mapping from integer token IDs back to symbols.


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