47 Lr0Item(std::string antecedent, std::vector<std::string> consequent,
48 std::string epsilon, std::string eol);
58 Lr0Item(std::string antecedent, std::vector<std::string> consequent,
59 unsigned int dot, std::string epsilon, std::string eol);
98template <>
struct hash<
Lr0Item> {
99 size_t operator()(
const Lr0Item& item)
const;
Represents an LR(0) item used in LR automata construction.
Definition lr0_item.hpp:14
std::string antecedent_
The non-terminal on the left-hand side of the production.
Definition lr0_item.hpp:18
unsigned int dot_
The position of the dot (·) in the production.
Definition lr0_item.hpp:38
bool operator==(const Lr0Item &other) const
Equality operator for comparing two LR(0) items.
Definition lr0_item.cpp:85
Lr0Item(std::string antecedent, std::vector< std::string > consequent, std::string epsilon, std::string eol)
Constructs an LR(0) item with the dot at position 0.
Definition lr0_item.cpp:11
std::string epsilon_
The symbol representing the empty string (ε).
Definition lr0_item.hpp:28
std::string NextToDot() const
Returns the symbol immediately after the dot, or empty if the dot is at the end.
Definition lr0_item.cpp:34
bool IsComplete() const
Checks whether the dot has reached the end of the production.
Definition lr0_item.cpp:47
std::vector< std::string > consequent_
The sequence of symbols on the right-hand side of the production.
Definition lr0_item.hpp:23
void PrintItem() const
Prints the LR(0) item to the standard output in a human-readable format.
Definition lr0_item.cpp:54
void AdvanceDot()
Advances the dot one position to the right.
Definition lr0_item.cpp:41
std::string eol_
The symbol representing end-of-line or end-of-input ($).
Definition lr0_item.hpp:33
std::string ToString() const
Converts the item to a string representation, including the dot position.
Definition lr0_item.cpp:68