Module Coverage.AndorSource

Sourcetype ('g, 'lrc, 'n) node = {
  1. lrc : 'lrc Fix.Indexing.index;
  2. rpos : 'g Redpos.t Fix.Indexing.Opt.n Fix.Indexing.index;
  3. active : 'g Info.terminal Utils.Misc.indexset;
  4. mutable successors : ('g Info.terminal Utils.Misc.indexset * 'n Fix.Indexing.index) array;
}

Non-deterministic AND-OR graph for coverability analysis. OR nodes represent choice points where multiple reductions may fire. AND nodes represent deterministic stack consumption during a reduction.

Sourcetype ('g, 'lrc, 'n) _graph = {
  1. initials : ('lrc, 'g Info.terminal Utils.Misc.indexset * 'n Fix.Indexing.index) Utils.Misc.indexmap;
  2. nodes : ('n, ('g, 'lrc, 'n) node) Fix.Indexing.vector;
}
Sourcetype ('g, 'lrc) graph =
  1. | Graph : ('g, 'lrc, 'n) _graph -> ('g, 'lrc) graph
Sourceval is_or_node : 'a Redpos.table -> ('a, 'b, 'c) node -> bool

Returns true when the node is an OR node, i.e., at a reduction choice point: either between reductions (rpos = None) or at the start of a reduction (rpos at position zero).

Sourceval top_state : 'a Kernel__Info.grammar -> ('a, 'b) Automata.stacks -> 'a Redpos.table -> ('a, 'b, 'c) node -> 'a Info.lr1 Fix.Indexing.index

Returns the top LR(1) state on the stack for a given node. For OR nodes (rpos = None), this is the label of the LRC state. For AND nodes mid-reduction on a nonterminal, this is the goto target from the LRC's label state.

Build the AND-OR graph by fixpoint iteration. Starting from each LRC state with all regular terminals as active lookahead, the graph explores reductions and stack pops. OR nodes branch into all applicable reductions; AND nodes chain through right-to-left consumption of production RHS symbols.