Parse routes for Aho scheduling #
Structural parse measures and canonical routes to consumed stack occurrences.
Number of constructors in a concrete parse. The direct scheduler decreases the sum of these counts on every grammar-facing composite step.
Equations
- (IndexedGrammar.NFParse.binary hr hlhs hc hrhs left right).nodeCount = left.nodeCount + right.nodeCount + 1
- (IndexedGrammar.NFParse.pop hr hlhs hc hrhs rest).nodeCount = rest.nodeCount + 1
- (IndexedGrammar.NFParse.push hr hlhs hc hrhs rest).nodeCount = rest.nodeCount + 1
- (IndexedGrammar.NFParse.terminal hr hlhs hc hrhs).nodeCount = 1
Instances For
Transporting only the stack index of a parse does not change its constructor count.
If a concrete parse consumes stack occurrence k + 1, it also consumes occurrence k.
Operationally, a derivation cannot reach a deeper stack occurrence without first popping the
one immediately above it.
Consumption is downward closed in the stack-position order.
If the top inherited occurrence is unused, every deeper inherited occurrence is unused too. This is the branch in which the scheduler may safely erase the inherited stack and run a plain task.
A parse can only consume an occurrence which is actually present in its inherited stack.
In particular, a task with empty inherited stack is necessarily plain.
Chosen routes to consumed stack occurrences #
A data-carrying choice of one branch leading to the pop which consumes stack occurrence k.
Every binary node crossed by such a route contributes a nonempty off-path yield interval; those
intervals are the owners of uncompressed index blocks.
- binaryLeft {T : Type} {g : IndexedGrammar T} {A B C : g.nt} {stack : List g.flag} {u v : List T} {r : IRule T g.nt g.flag} {hr : r ∈ g.rules} {hlhs : r.lhs = A} {hc : r.consume = none} {hrhs : r.rhs = [IRhsSymbol.nonterminal B none, IRhsSymbol.nonterminal C none]} {left : g.NFParse B stack u} {right : g.NFParse C stack v} {k : ℕ} (route : ConsumeRoute g left k) : ConsumeRoute g (binary hr hlhs hc hrhs left right) k
- binaryRight {T : Type} {g : IndexedGrammar T} {A B C : g.nt} {stack : List g.flag} {u v : List T} {r : IRule T g.nt g.flag} {hr : r ∈ g.rules} {hlhs : r.lhs = A} {hc : r.consume = none} {hrhs : r.rhs = [IRhsSymbol.nonterminal B none, IRhsSymbol.nonterminal C none]} {left : g.NFParse B stack u} {right : g.NFParse C stack v} {k : ℕ} (route : ConsumeRoute g right k) : ConsumeRoute g (binary hr hlhs hc hrhs left right) k
- popHere {T : Type} {g : IndexedGrammar T} {A B : g.nt} {f : g.flag} {stack : List g.flag} {w : List T} {r : IRule T g.nt g.flag} {hr : r ∈ g.rules} {hlhs : r.lhs = A} {hc : r.consume = some f} {hrhs : r.rhs = [IRhsSymbol.nonterminal B none]} {rest : g.NFParse B stack w} : ConsumeRoute g (pop hr hlhs hc hrhs rest) 0
- popTail {T : Type} {g : IndexedGrammar T} {A B : g.nt} {f : g.flag} {stack : List g.flag} {w : List T} {r : IRule T g.nt g.flag} {hr : r ∈ g.rules} {hlhs : r.lhs = A} {hc : r.consume = some f} {hrhs : r.rhs = [IRhsSymbol.nonterminal B none]} {rest : g.NFParse B stack w} {k : ℕ} (route : ConsumeRoute g rest k) : ConsumeRoute g (pop hr hlhs hc hrhs rest) (k + 1)
- push {T : Type} {g : IndexedGrammar T} {A B : g.nt} {f : g.flag} {stack : List g.flag} {w : List T} {r : IRule T g.nt g.flag} {hr : r ∈ g.rules} {hlhs : r.lhs = A} {hc : r.consume = none} {hrhs : r.rhs = [IRhsSymbol.nonterminal B (some f)]} {rest : g.NFParse B (f :: stack) w} {k : ℕ} (route : ConsumeRoute g rest (k + 1)) : ConsumeRoute g (NFParse.push hr hlhs hc hrhs rest) k
Instances For
Forget the chosen route and recover the proposition-valued consumption fact.
Equations
- ⋯ = ⋯
Instances For
Every proposition-valued consumption fact admits a concrete route.
Consumption and existence of a chosen route are equivalent.
Choose a route from a known consumption fact.
Equations
Instances For
Disjoint terminal owners along a consumption route #
At a binary event, charge the fresh block to the first terminal position of the child not followed by the consumption route. Recursively chosen barriers lie inside the followed child, so all of these owners are distinct.
Equations
- route.binaryLeft.barrierOwners = ⟨u.length, ⋯⟩ :: List.map (IndexedGrammar.NFParse.ConsumeRoute.embedLeft u v) route.barrierOwners
- route.binaryRight.barrierOwners = ⟨0, ⋯⟩ :: List.map (IndexedGrammar.NFParse.ConsumeRoute.embedRight u v) route.barrierOwners
- IndexedGrammar.NFParse.ConsumeRoute.popHere.barrierOwners = []
- route.popTail.barrierOwners = route.barrierOwners
- route.push.barrierOwners = route.barrierOwners
Instances For
Off-path owners selected at distinct binary events on one route are pairwise distinct.
Consequently the number of productive barriers on any one consumption route is bounded by the terminal yield length.
A route has no productive barrier exactly when it reaches its pop using only unary push/pop constructors.