handouts/ho06.tex
changeset 392 2d0a59127694
parent 386 31295bb945c6
child 584 529460073b24
--- a/handouts/ho06.tex	Mon Dec 07 17:50:05 2015 +0000
+++ b/handouts/ho06.tex	Sat Dec 19 21:11:23 2015 +0000
@@ -37,10 +37,10 @@
 to process from the input and the second is the unprocessed
 part of the input. As we shall see shortly, a parser
 combinator might return more than one such pair, the idea
-being that there are potentially several ways how to interpret
-the input. To simplify matters we will first look at the case
-where the input to the parser combinators is just strings. As
-a concrete example, consider the string
+being that there are potentially several ways of how to
+interpret the input. To simplify matters we will first look at
+the case where the input to the parser combinators is just
+strings. As a concrete example, consider the string
 
 \begin{center}
 \tt\Grid{iffoo\VS testbar}
@@ -65,15 +65,14 @@
 ``went wrong''\ldots or more precisely, nothing could be
 parsed.
 
-The main attraction of parser combinators is that we can
-easily build parser combinators out of smaller components
-following very closely the structure of a grammar. In order to
-implement this in an object-oriented programming language,
-like Scala, we need to specify an abstract class for parser
-combinators. This abstract class requires the implementation
-of the function \texttt{parse} taking an argument of type
-\texttt{I} and returns a set of type \mbox{\texttt{Set[(T,
-I)]}}.
+The idea of parser combinators is that we can easily build
+parser combinators out of smaller components following very
+closely the structure of a grammar. In order to implement this
+in an object-oriented programming language, like Scala, we
+need to specify an abstract class for parser combinators. This
+abstract class requires the implementation of the function
+\texttt{parse} taking an argument of type \texttt{I} and
+returns a set of type \mbox{\texttt{Set[(T, I)]}}.
 
 \begin{center}
 \begin{lstlisting}[language=Scala]
@@ -132,7 +131,7 @@
 More interesting are the parser combinators that build larger
 parsers out of smaller component parsers. For example the
 alternative parser combinator is as follows: given two
-parsers, say, $p$ and $q$, then we apply both parsers to the
+parsers, say, $p$ and $q$, we apply both parsers to the
 input (remember parsers are functions) and combine the output
 (remember they are sets)
  
@@ -194,7 +193,7 @@
 
 \noindent We receive in the first two cases a successful
 output (that is a non-empty set). In each case, either
-\pcode{a} or \pcode{b} are in the processed parts, and
+\pcode{a} or \pcode{b} is in the processed part, and
 \pcode{c} in the unprocessed part. Clearly this parser cannot
 parse anything in the string \pcode{cc}, therefore the empty
 set.