68 Lr0Item(std::string antecedent, std::vector<std::string> consequent,
69 std::string epsilon, std::string eol);
79 Lr0Item(std::string antecedent, std::vector<std::string> consequent,
80 unsigned int dot, std::string epsilon, std::string eol);
122template <>
struct hash<
Lr0Item> {
123 size_t operator()(
const Lr0Item& item)
const;
Represents an LR(0) item used in LR automata construction.
Definition lr0_item.hpp:35
std::string antecedent_
The non-terminal on the left-hand side of the production.
Definition lr0_item.hpp:39
unsigned int dot_
The position of the dot (ยท) in the production.
Definition lr0_item.hpp:59
bool operator==(const Lr0Item &other) const
Equality operator for comparing two LR(0) items.
Definition lr0_item.cpp:100
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:29
std::string epsilon_
The symbol representing the empty string ( ).
Definition lr0_item.hpp:49
std::string NextToDot() const
Returns the symbol immediately after the dot, or empty if the dot is at the end.
Definition lr0_item.cpp:47
bool IsComplete() const
Checks whether the dot has reached the end of the production.
Definition lr0_item.cpp:61
std::vector< std::string > consequent_
The sequence of symbols on the right-hand side of the production.
Definition lr0_item.hpp:44
void PrintItem() const
Prints the LR(0) item to the standard output in a human-readable format.
Definition lr0_item.cpp:69
void AdvanceDot()
Advances the dot one position to the right.
Definition lr0_item.cpp:55
std::string eol_
The symbol representing end-of-line or end-of-input ($).
Definition lr0_item.hpp:54
std::string ToString() const
Converts the item to a string representation, including the dot position.
Definition lr0_item.cpp:83