Skip to content
This repository has been archived by the owner on Mar 25, 2022. It is now read-only.

Commit

Permalink
Work on Marpa theory book
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffrey Kegler committed Mar 23, 2016
1 parent 9bf02fc commit 0fca447
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions recce.ltx
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ rewriting or rethinking.
\label{ch:introduction}

The Marpa project was intended to create
a practical, highly available, tool
a practical and highly available tool
to generate and use general context-free
parsers.
Tools of this kind
Expand All @@ -489,7 +489,7 @@ no such tool had existed for context-free parsing.

The first stable version of Marpa was uploaded to
a public archive on Solstice Day 2011.
This paper describes the algorithm used
This monograph describes the algorithm used
in the most recent version of Marpa,
Marpa::R2~\cite{Marpa-R2}.
It is a simplification of the algorithm presented
Expand Down Expand Up @@ -518,7 +518,7 @@ In this monograph, we describe the Marpa
algorithm
as it was implemented for Marpa::R2.
In many cases,
we believe there are better approaches better than those we
we believe there are better approaches than those we
have described.
But we treat these techniques,
however solid their theory,
Expand Down Expand Up @@ -581,9 +581,9 @@ the error is fully recoverable.
An application can try to read another
token.
The application can do this repeatedly
as long as none of the tokens is accepted.
as long as none of the tokens are accepted.
Once the application provides
an token that is accepted by the parser,
a token that is accepted by the parser,
parsing will continue
as if the unsuccessful read attempts had never been made.

Expand All @@ -593,7 +593,7 @@ These are often useful in natural language processing
where, for example,
the same word might be a verb or a noun.
Use of ambiguous tokens can be combined with
with recovery from rejected tokens so that,
recovery from rejected tokens so that,
for example, an application could react to the
rejection of a token by reading two others.

Expand All @@ -614,9 +614,9 @@ and what the alternatives were.

\subsection{Event driven parsing}
As implemented,
Marpa::R2~\cite{Marpa-R2},
Marpa::R2~\cite{Marpa-R2}
allows the user to define ``events''.
Events can defined that trigger when a specified rule is complete,
Events can be defined that trigger when a specified rule is complete,
when a specified rule is predicted,
when a specified symbol is nulled,
when a user-specified lexeme has been scanned,
Expand All @@ -626,7 +626,7 @@ at the desired point in the rule,
and defining an event which triggers when the symbol is nulled.

\subsection{Ruby slippers parsing}
Left-eideticism, efficient error recovery
Left-eideticism, efficient error recovery,
and the event mechanism can be combined to allow
the application to change the input in response to
feedback from the parser.
Expand All @@ -652,7 +652,7 @@ parse with a clean
but oversimplified grammar,
programming the lexical analyzer to make up for the grammar's
short-comings on the fly.
As part of the Marpa::R2~\cite{Marpa-R2},
As part of Marpa::R2~\cite{Marpa-R2},
the author has implemented an HTML parser,
based on a grammar that assumes that all start
and end tags are present.
Expand Down Expand Up @@ -732,9 +732,8 @@ to be specified for each RHS.
Marpa::R2's precedenced rules are implemented as
a true second order language.
The SLIF representation of the precedenced rule
is parsed to create a BNF grammar which
is equivalent and which
has the desired precedence.
is parsed to create a BNF grammar which is equivalent,
and which has the desired precedence.
Essentially,
the SLIF does a standard textbook transformation.
The transformation starts
Expand Down Expand Up @@ -765,8 +764,8 @@ allows the definition of multiple ternary operators,
and multiple operators with arity above three.

Second, and more important, a SLIF user is guaranteed
to get exactly the language that the precedenced rule specifies,
while the user of the yacc equivalent must hope their
to get exactly the language that the precedenced rule specifies.
The user of the yacc equivalent must hope their
syntax falls within the limits of LALR.

\section{How to read this document}
Expand Down

0 comments on commit 0fca447

Please sign in to comment.