pub enum MaterializationStrategy<'h> {
TopDownCondensed,
IndexedCondensed,
Astar {
heuristic: AstarHeuristic<'h>,
options: AstarOptions,
},
}Expand description
Which algorithm to use when materializing an intersection.
The strategies recognize the same derivations but explore the product automaton differently:
TopDownCondensedis the recommended default when a complete chart is needed.IndexedCondensedis primarily useful for algorithm comparison, statistics, or workloads where benchmarking shows it is advantageous. It can generate very large candidate sets for some ambiguous or discontinuous decompositions.Astaris intended for weight-directed search and can stop early when only the best derivation is needed.
Strategy choice depends on the resulting IRTG, its decomposition automata, and representative inputs—not on the grammar’s source filename or codec. See the parsing-algorithm guide for a user-facing comparison.
Variants§
TopDownCondensed
Top-down condensed intersection.
This is the default used by Irtg::parse. It starts from accepting
product states and follows compatible condensed rules downward,
producing a complete explicit parse chart.
Prefer this as the general chart-building default unless measurements on the intended workload support another choice.
IndexedCondensed
Bottom-up indexed condensed intersection.
This grows reachable product states through partial-child indexes and returns detailed intersection statistics. It also produces a complete chart; it is not an early-exit one-best parser.
Candidate generation can become substantially more expensive than the
top-down strategy for some workloads, including some TAG-derived IRTGs.
This is a property of the automata and inputs, not of a .tag filename.
Astar
A* intersection with a configurable heuristic.
Precondition: all grammar rule weights must be ≤ 1 (probability
weights). If any weight exceeds 1 the strategy is rejected at
parse time with IrtgError::AstarWeightPrecondition.
Use this when weight-directed search or early one-best termination is more important than constructing the complete parse chart. Heuristic compatibility depends on the input algebra; SX-family heuristics are specific to compatible string interpretations.
Fields
heuristic: AstarHeuristic<'h>Heuristic to guide the A* search.
options: AstarOptionsOptions for the A* materializer.