KernelSourceThis module is responsible for generating a deterministic finite automaton (DFA) from a given grammar and lookahead set. The DFA is used to perform pattern matching on input tokens according to the grammar rules. The module includes several stages:
This module defines data structures and operations for handling grammar information in a structured way. It includes representations for terminals, non-terminals, productions, and LR states, along with their transitions and reductions. The module is designed to work with Menhir's grammar representation and extends it with additional functionality for convenience.
This module computes the reachability of states in a parser automaton. It is used to reason about the behavior of an LR(1) automaton after conflict resolution (with some transitions removed). The module implements algorithms for partitioning lookahead symbols with identical behaviors, and uses these partitions to determine the cost of reaching each state with a given lookahead.