21#include <unordered_map>
22#include <unordered_set>
55 std::unordered_map<std::string, symbol_type>
st_{
79 void PutSymbol(
const std::string& identifier,
bool isTerminal);
87 bool In(
const std::string& s)
const;
Stores and manages grammar symbols, including their classification and special markers.
Definition symbol_table.hpp:45
bool IsTerminal(const std::string &s) const
Checks if a symbol is a terminal.
Definition symbol_table.cpp:39
std::unordered_map< std::string, symbol_type > st_
Main symbol table, mapping identifiers to a pair of symbol type and its regex.
Definition symbol_table.hpp:55
bool IsTerminalWthoEol(const std::string &s) const
Checks if a symbol is a terminal excluding EOL.
Definition symbol_table.cpp:43
bool In(const std::string &s) const
Checks if a symbol exists in the symbol table.
Definition symbol_table.cpp:35
std::string EOL_
End-of-line symbol used in parsing, initialized as "$".
Definition symbol_table.hpp:47
std::unordered_set< std::string > terminals_wtho_eol_
Set of terminal symbols excluding the EOL symbol ($).
Definition symbol_table.hpp:66
void PutSymbol(const std::string &identifier, bool isTerminal)
Adds a non-terminal symbol to the symbol table.
Definition symbol_table.cpp:23
std::string EPSILON_
Epsilon symbol, representing empty transitions, initialized as "EPSILON".
Definition symbol_table.hpp:51
std::unordered_set< std::string > non_terminals_
Set of all non-terminal symbols.
Definition symbol_table.hpp:71
std::unordered_set< std::string > terminals_
Set of all terminal symbols (including EOL).
Definition symbol_table.hpp:61
symbol_type
Represents the type of a grammar symbol.
Definition symbol_table.hpp:33
@ TERMINAL
Definition symbol_table.hpp:33
@ NO_TERMINAL
Definition symbol_table.hpp:33