Browse files


  • Loading branch information...
Jeffrey Kegler Jeffrey Kegler
Jeffrey Kegler authored and Jeffrey Kegler committed Feb 28, 2014
1 parent b5210e6 commit 4f9f8d6dbf773b4bc0b6700c95d0760c1de83601
Showing with 73 additions and 4 deletions.
  1. +73 −4 recce.ltx
@@ -2053,6 +2053,24 @@ the previous two equalities.
+In the following we extend the notation for sentential forms to
+allow location to be indicate.
+Specifically, to indicate in the sentential form
+ \Vsf{a} \cat \Vsf{b} \mydot \Vsf{c}
+that \Vloc{x} is between \Vsf{a} and \Vsf{b},
+and that the dot is at location \var{y},
+we will write
+ \Vsf{a} \; [\var{x}] \; \Vsf{b} \; [\var{y}] \; \Vsf{c}.
+We will also sometimes indicate the dot location
+more explicitly
+ \Vsf{a} \; [\var{x}] \; \Vsf{b} \; [\var{dot}] \; \Vsf{c}.
a \dfn{finite derivation grammar} is an unambiguous grammar
which can be parsed by considering, at any location
@@ -2119,13 +2137,64 @@ This means that at least two of the medial Earley items,
call them \Veim{eim1} and \Veim{eim2} must share the
same dotted rule, call it \Vdr{shared}.
We can write these two Earley items
- \Veim{eim1} = [ \Vdr{shared}, \Vloc{origin1} ] \\
- \text{and} \quad \Veim{eim2} = [ \Vdr{shared}, \Vloc{origin2} ]
+ \label{e:medial-eim1} \Veim{eim1} = [ \Vdr{shared}, \Vloc{origin1} ] \\
+ \label{e:medial-eim2} \text{and} \quad \Veim{eim2} = [ \Vdr{shared}, \Vloc{origin2} ] \\
+ \text{where} \quad \Vdr{shared} = [ \Vsym{A} \de \Vsf{pre-dot} \mydot \Vsf{post-dot} ]
Since by the assumption for the reduction,
\Veim{eim1} and \Veim{eim2} differ, we have
$\Vloc{origin1} \neq \Vloc{origin2}$.
+If $\Vloc{origin1} \neq \Vloc{origin2}$
+within a single right derivation,
+the rule must recurse:
+ \label{e:finite-medial-claim2} \Vsym{A} \destar
+ \Vsf{pre-A} \cat \Vsym{A} \cat \Vsf{post-A} \mydot \Vsf{post-dot}.
+But this is not possible at the same dot location, as we will show
+To show that \eqref{e:finite-medial-claim2}
+is not possible,
+assume that the one of the two Earley items \eqref{e:medial-eim1}
+and \eqref{e:medial-eim2} derives the other.
+Without loss of generality, we describe
+the recursion as $\Vsf{pre-dot} \destar \Vsf{pre-A} \cat \Vsym{A} \cat \Vsf{post-dot}$,
+where \Vsf{pre-A} and \Vsf{post-A} can derive the null string.
+As a reminder, internal Marpa rules
+never derive the null string and,
+by the definition of medial rule, neither can the pre- and post-dot
+portions of that medial rule.
+If we follow the recursion through a double derivation
+\notag \Vsym{A} \de & \Vsf{pre-dot} \mydot \Vsf{post-dot} \\
+ \destar & \Vsf{pre-A} \cat \Vsym{A} \cat \Vsf{post-A} \mydot \var{post-dot} \\
+\destar &
+ \var{pre-A} \cat \var{pre-dot} \mydot \var{post-dot} \cat \var{post-A} \mydot \var{post-dot},
+We see that in derivation step
+the dot is required to be both before and after the
+sentential form $\Vsf{post-dot} \cat \Vsf{post-A}$.
+This is not possible, because \Vsf{post-dot} cannot derive the null string.
+This completes the reductio, and allows us to conclude that
+\eqref{e:finite-medial-claim2} is not possible.
+Since medial Earley items cannot recurse at the same Earley set,
+it is not possible for
+two Earley items, corresponding to a single rightmost derivation,
+and with the same medial dotted rule,
+to appear in the same Earley set.
+This means that there can be,
+in each Earley set,
+at most one medial Earley item for
+each dotted rule and rightmost derivation.

0 comments on commit 4f9f8d6

Please sign in to comment.