Skip to main content

Module lr

Module lr 

Source
Expand description

Implements LR(0), LR(1), and LALR(1) items and item sets

Includes closure/goto operations for parse table generation.

Structs§

LalrClosure
A set of LALR(1) items, representing the full closure of an LALR(1) state
LalrItem
Represents a LALR(1) item: an LR(0) item with a set of lookahead tokens This is what LALR(1) parsers use - combining LR(1) states with the same core
LalrKernel
A set of LALR(1) items, representing the kernel of an LALR(1) state
Lr0Closure
A set of LR(0) items, representing the full closure of an LR(0) state
Lr0Item
Represents an LR(0) item: a grammar rule with a position marker (dot) Example: “E -> E . + T” (rule for “E -> E + T” with dot before “+”)
Lr0Kernel
A set of LR(0) items, representing the kernel of an LR(0) state
Lr1Closure
A set of LR(1) items, representing the full closure of an LR(1) state
Lr1Item
Represents an LR(1) item: an LR(0) item with a single lookahead token Example: “E -> E . + T”, “$” (with “$” as lookahead)
Lr1Kernel
A set of LR(1) items, representing the kernel of an LR(1) state

Enums§

InternalToken
Internal token representation used during parser generation