3#include <unordered_map>
4#include <unordered_set>
60 void PutSymbol(
const std::string& identifier,
bool isTerminal);
68 bool In(
const std::string& s)
const;
Stores and manages grammar symbols, including their classification and special markers.
Definition symbol_table.hpp:26
bool IsTerminal(const std::string &s) const
Checks if a symbol is a terminal.
Definition symbol_table.cpp:21
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:36
bool IsTerminalWthoEol(const std::string &s) const
Checks if a symbol is a terminal excluding EOL.
Definition symbol_table.cpp:25
bool In(const std::string &s) const
Checks if a symbol exists in the symbol table.
Definition symbol_table.cpp:17
std::string EOL_
End-of-line symbol used in parsing, initialized as "$".
Definition symbol_table.hpp:28
std::unordered_set< std::string > terminals_wtho_eol_
Set of terminal symbols excluding the EOL symbol ($).
Definition symbol_table.hpp:47
void PutSymbol(const std::string &identifier, bool isTerminal)
Adds a non-terminal symbol to the symbol table.
Definition symbol_table.cpp:5
std::string EPSILON_
Epsilon symbol, representing empty transitions, initialized as "EPSILON".
Definition symbol_table.hpp:32
std::unordered_set< std::string > non_terminals_
Set of all non-terminal symbols.
Definition symbol_table.hpp:52
std::unordered_set< std::string > terminals_
Set of all terminal symbols (including EOL).
Definition symbol_table.hpp:42
symbol_type
Represents the type of a grammar symbol.
Definition symbol_table.hpp:15
@ TERMINAL
Definition symbol_table.hpp:15
@ NO_TERMINAL
Definition symbol_table.hpp:15