package lrgrep
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
Detailed error messages for Menhir-generated parsers
Install
dune-project
Dependency
Authors
Maintainers
Sources
lrgrep-0.9.tbz
sha256=e53de12e4c5cbe6bca00643593266b4f9fa2e3f6a138195eeff7a4329f5c1c75
sha512=7fd7c4d11506fea7cc11c9bbf5aea9142d905643553c0c90e1bb16b794106b0c14a266acf89ae91b6929008dc0ba6515f788642873e2e4ba6c3d49bd45d25127
doc/kernel/Kernel/Reachability/index.html
Module Kernel.ReachabilitySource
Reachability analysis for LR automata after conflict resolution
This module computes the reachability of states in a parser automaton after conflicts have been resolved (some transitions removed). It's used to reason about the actual behavior of the parser and compute minimal parsing costs.
Architecture:
- The module computes classes of terminals that have identical behavior across all transitions. This is used to compact cost matrices.
- The Tree module builds a DAG of all matrix products that appear in the cost equations.
- The Cell module provides compact encoding of matrix cells as integers.
- The Analysis module solves the resulting dataflow problem to compute minimal costs for reaching each state with each lookahead class.
The module uses:
- Tarjan's SCC algorithm for computing strongly connected components
- Dataflow analysis with fixpoint iteration for computing costs
Implementation details:
- The
Classesmodule uses a refinement-based fixedpoint iteration to compute partitionings of terminals. Each SCC is processed in reverse topological order, using the current approximation for recursive occurrences.
- The
Coercionmodule implements the coerce matrices for changing between different partitionings. Theinfixfunction handles the special case where the last class is omitted (it has infinite cost).
- The
Treemodule hash-conses the matrix DAG to avoid duplicates. TheConsedTreefunctor produces a tree where inner nodes represent matrix products and leaves represent individual transition costs.
- The
Cellmodule uses a clever bit-packing scheme to encode (node, pre_class, post_class) as a single integer, enabling efficient storage of large cost matrices.
- The
Solvermodule implements two analyses: - Shortest path analysis computing minimal costs
- Finite language analysis computing which cells are reachable
- The
Reverse_dependenciesmodule tracks how changes to one cell affect others, enabling efficient incremental updates during the dataflow analysis.
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>