Block denotation for Aho's work tape #
Compressed indices must be interpreted as separate visible stack blocks. Flags omitted by a
plainPushSkip move are ghost gaps between those blocks: flattening the visible blocks loses the
position of such a gap and makes plainPushUse followed by popPlain impossible to justify.
The continues bit is Aho's first/later distinction (IndexMark.later). A continuing block has
no hidden gap after it and exposes another live block when popped. A first block may expose an
arbitrary hidden gap and therefore returns to a plain nonterminal.
Visible blocks and hidden decorations #
Visible block stack, nearest compressed token first.
Equations
Instances For
A plain nonterminal may have an arbitrary hidden gap before the first visible block and after every non-continuing block.
Equations
- One or more equations did not get rendered due to their size.
- IndexedGrammar.Aho.BlockDenotation.Decorates [] x✝ = True
Instances For
A live nonterminal starts with the first visible block. Its following gap is controlled by
that block's continues bit.
Equations
- One or more equations did not get rendered due to their size.
- IndexedGrammar.Aho.BlockDenotation.LiveDecorates [] x✝ = False
Instances For
Add one unused flag to the leading hidden gap of a plain stack.
A first used push turns a decorated plain stack into a live stack with a fresh first block.
Forget that the first visible block is forced to start at the top of the actual stack.
A later used push creates a fresh continuing block above a live stack.
Compressing a new flag into the current visible block preserves its continuation bit and all hidden gaps below it.
Pop a first/non-continuing block. The remainder is a plain decorated stack.
Pop a continuing block. Aho's later=true guard exposes a live decorated tail.
Delimiter-free segments #
Right-to-left denotation of one delimiter-free segment. Visible indices build a block stack; each nonterminal independently chooses the hidden gaps permitted by its plain/live decoration.
- nil {T : Type} {g : IndexedGrammar T} [Fintype g.nt] (inherited : VisibleStack g) : SegmentRep g inherited [] inherited []
- terminal {T : Type} {g : IndexedGrammar T} [Fintype g.nt] {inherited stack : VisibleStack g} {xs : List (WorkSym g)} {form : List g.ISym} (a : T) (tail : SegmentRep g inherited xs stack form) : SegmentRep g inherited (WorkSym.terminal a :: xs) stack (ISym.terminal a :: form)
- plain {T : Type} {g : IndexedGrammar T} [Fintype g.nt] {inherited stack : VisibleStack g} {xs : List (WorkSym g)} {form : List g.ISym} (A : g.nt) (actual : List g.flag) (decorates : Decorates stack actual) (tail : SegmentRep g inherited xs stack form) : SegmentRep g inherited (WorkSym.plain A :: xs) stack (ISym.indexed A actual :: form)
- live {T : Type} {g : IndexedGrammar T} [Fintype g.nt] {inherited stack : VisibleStack g} {xs : List (WorkSym g)} {form : List g.ISym} (A : g.nt) (actual : List g.flag) (decorates : LiveDecorates stack actual) (tail : SegmentRep g inherited xs stack form) : SegmentRep g inherited (WorkSym.live A :: xs) stack (ISym.indexed A actual :: form)
- index {T : Type} {g : IndexedGrammar T} [Fintype g.nt] {inherited stack : VisibleStack g} {xs : List (WorkSym g)} {form : List g.ISym} {R : CFlag g} (d : IndexMark) (flags : List g.flag) (denotes : CFlag.Denotes g flags R) (tail : SegmentRep g inherited xs stack form) : SegmentRep g inherited (WorkSym.index R d :: xs) ({ flags := flags, continues := d.later } :: stack) form
Instances For
Splitting a segment exposes the intermediate visible block stack and splits its form.
Index-free segments preserve the visible inherited block stack.
Changing an index mark without changing its first/later bit preserves the denotation.
Nested frame layout #
Equations
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
- current {T : Type} {g : IndexedGrammar T} [Fintype g.nt] {inherited before : VisibleStack g} {current : List (WorkSym g)} {form : List g.ISym} (segment : SegmentRep g inherited current before form) : NestedRep g inherited [] current form
- frame {T : Type} {g : IndexedGrammar T} [Fintype g.nt] {inherited tailStack pendingStack : VisibleStack g} {pending suffix current : List (WorkSym g)} {frames : List (FrameBoundary g)} {suffixForm pendingForm innerForm : List g.ISym} (suffixRep : SegmentRep g inherited suffix tailStack suffixForm) (pendingRep : SegmentRep g tailStack pending pendingStack pendingForm) (pendingEndsIndex : ∃ (beta : List (WorkSym g)) (R : CFlag g) (d : IndexMark), pending = beta ++ [WorkSym.index R d]) (innerRep : NestedRep g tailStack frames current innerForm) : NestedRep g inherited ((pending, suffix) :: frames) current (innerForm ++ pendingForm ++ suffixForm)
Instances For
Equations
- One or more equations did not get rendered due to their size.