package lrgrep
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=e53de12e4c5cbe6bca00643593266b4f9fa2e3f6a138195eeff7a4329f5c1c75
sha512=7fd7c4d11506fea7cc11c9bbf5aea9142d905643553c0c90e1bb16b794106b0c14a266acf89ae91b6929008dc0ba6515f788642873e2e4ba6c3d49bd45d25127
doc/kernel/Kernel/Coverage/Deter/index.html
Module Coverage.DeterSource
type ('g, 'n, 'm) node = {index : 'm Fix.Indexing.index;ker : 'n Utils.Misc.indexset;mutable top : 'g Info.lr1 Utils.Misc.indexset;mutable accept : 'g Info.terminal Utils.Misc.indexset;mutable successors : ('g Info.terminal Utils.Misc.indexset * ('g, 'n, 'm) node) array;
}Deterministic automaton obtained by merging Andor OR nodes into single states and grouping AND nodes that branch on the same LR state. Lookahead sets are intentionally excluded from the DFA kernel to avoid combinatorial explosion.
type ('g, 'lrc, 'n, 'm) _graph = {initials : ('lrc, 'g Info.terminal Utils.Misc.indexset * 'm Fix.Indexing.index) Utils.Misc.indexmap;nodes : ('m, ('g, 'n, 'm) node) Fix.Indexing.vector;
}Returns the LRC state shared by all Andor nodes in the kernel of a Deter node. All Andor nodes in a Deter kernel are guaranteed to have the same LRC state.
val make :
'g Info.grammar ->
('g Info.lr1, 'g Redgraph.reduction_closure) Fix.Indexing.vector ->
('g, 'lrc) Automata.stacks ->
'g Redpos.table ->
('g, 'lrc, 'n) Andor._graph ->
('g, 'lrc, 'n) graphBuild the deterministic graph from an Andor graph. OR nodes are collapsed via epsilon transitions; AND nodes are grouped by their branching LR state. The resulting DFA tracks which Andor nodes form each kernel, along with accumulated accept sets and top LR(1) states.
val get_lr0 :
'g Info.grammar ->
('g Info.lr1, 'g Redgraph.reduction_closure) Fix.Indexing.vector ->
('g, 'lrc) Automata.stacks ->
'g Redpos.table ->
('g, 'lrc, 'n) Andor._graph ->
('g, 'lrc, 'n, 'm) _graph ->
int ->
'g Kernel__Info.lr0 Utils.IndexSet.tCompute the set of LR(0) states reachable from a Deter node. Traverses the Andor graph from the node's kernel, following OR nodes down through reduction closure trees, and collecting the LR(0) base state at each leaf. Used for mapping coverage results back to human-readable grammar states.