Concrete parser-stack representation #
The DPDA stores canonical kernels rather than grammar symbols. For every
symbol in a canonical parser stack it stores the kernel reached after the
corresponding prefix, with the current kernel on top and none as a permanent
bottom marker.
noncomputable def
CF_grammar.LRk.Buffered.stackRep
{T : Type}
[Fintype T]
(G : CF_grammar T)
(k : ℕ)
(gamma : List (symbol T G.augment.nt))
:
List (StackSymbol G k)
Complete concrete stack representing a grammar-symbol parser stack.
Equations
Instances For
theorem
CF_grammar.LRk.Buffered.stackRep_top
{T : Type}
[Fintype T]
(G : CF_grammar T)
(k : ℕ)
(gamma : List (symbol T G.augment.nt))
:
∃ (Z : StackSymbol G k) (rest : List (StackSymbol G k)),
stackRep G k gamma = Z :: rest ∧ kernelOfTop G k Z = scanKernel G k gamma
The represented stack is always nonempty, and its top denotes the current
canonical kernel (with none denoting the initial kernel).
theorem
CF_grammar.LRk.Buffered.stackRep_append_frames
{T : Type}
[Fintype T]
(G : CF_grammar T)
(k : ℕ)
(gamma delta : List (symbol T G.augment.nt))
:
Appending delta grammar symbols adds exactly delta.length non-bottom
frames above the representation of the old prefix.