Langlib

Langlib.Grammars.LR.Equivalence.BufferedDPDA

Buffered canonical LR machine #

This file is the concrete finite-control compilation of the canonical LR table. Its input alphabet is Option T: some a encodes an ordinary terminal and none is a consumed right endmarker. The machine keeps a positive fixed lookahead buffer in its control, so EOF-only reductions never need to test raw input exhaustion.

@[reducible, inline]

Finite cursor used while popping the right-hand side of a reduction.

Equations
Instances For
    Equations
    Instances For
      def CF_grammar.LRk.Buffered.setBuffer {T : Type} {k : } (u : Lookahead T k) (n : ) (x : Option T) :

      Replace one slot in a fixed lookahead buffer.

      Equations
      Instances For

        On consuming the explicit endmarker during preload, preserve the already loaded prefix and pad every remaining slot with EOF.

        Equations
        Instances For
          def CF_grammar.LRk.Buffered.shiftBuffer {T : Type} {k : } (_hk : 0 < k) (u : Lookahead T k) (x : Option T) :

          Shift a positive lookahead buffer left and append one newly read symbol.

          Equations
          Instances For
            def CF_grammar.LRk.Buffered.lastBuffer {T : Type} {k : } (hk : 0 < k) (u : Lookahead T k) :

            Last buffered symbol.

            Equations
            Instances For
              inductive CF_grammar.LRk.Buffered.Control {T : Type} [Fintype T] (G : CF_grammar T) (k : ) :

              Finite control of the marked-input LR machine.

              Instances For
                instance CF_grammar.LRk.Buffered.instFintypeControl {T✝ : Type} {inst✝ : Fintype T✝} {G✝ : CF_grammar T✝} {k✝ : } [Fintype T✝] :
                Fintype (Control G✝ k✝)
                Equations
                • One or more equations did not get rendered due to their size.
                @[reducible, inline]

                Stack symbols are saved raw canonical kernels; none is the permanent bottom marker.

                Equations
                Instances For

                  Kernel represented by a stack top, interpreting the bottom marker as the initial kernel.

                  Equations
                  Instances For

                    Initial buffered control. The positive-lookahead machine starts with an all-EOF scratch buffer and overwrites it from left to right.

                    Equations
                    Instances For
                      noncomputable def CF_grammar.LRk.Buffered.inputTransition {T : Type} [Fintype T] (G : CF_grammar T) (k : ) (hk : 0 < k) (q : Control G k) (x : Option T) (Z : StackSymbol G k) :

                      Input-reading transitions. Only preload and refill controls read the marked input; all parser operations are epsilon moves over already buffered symbols.

                      Equations
                      Instances For
                        noncomputable def CF_grammar.LRk.Buffered.epsilonTransition {T : Type} [Fintype T] (G : CF_grammar T) (k : ) (hk : 0 < k) (q : Control G k) (Z : StackSymbol G k) :

                        Epsilon transitions implementing table actions and finite reduction pops.

                        Equations
                        Instances For
                          noncomputable def CF_grammar.LRk.Buffered.machine {T : Type} [Fintype T] (G : CF_grammar T) (k : ) (hk : 0 < k) :
                          DPDA (Control G k) (Option T) (StackSymbol G k)

                          The concrete DPDA recognizing the explicitly endmarked canonical parser language.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For