updated
authorChristian Urban <christian dot urban at kcl dot ac dot uk>
Fri, 01 Nov 2013 15:56:17 +0000
changeset 176 3c2653fc8b5a
parent 175 5801e8c0e528
child 177 53def1fbf472
updated
handouts/ho06.pdf
handouts/ho06.tex
Binary file handouts/ho06.pdf has changed
--- a/handouts/ho06.tex	Fri Nov 01 13:16:43 2013 +0000
+++ b/handouts/ho06.tex	Fri Nov 01 15:56:17 2013 +0000
@@ -288,13 +288,31 @@
 
 \noindent
 In particular in programming languages we will try to avoid ambiguous
-grammars as two different parse-trees for a string means a program can
-be interpreted in two different ways. Then we have to somehow make sure
+grammars because two different parse-trees for a string mean a program can
+be interpreted in two different ways. In such cases we have to somehow make sure
 the two different ways do not matter, or disambiguate the grammar in
 some way (for example making the $+$ left-associative). Unfortunately already 
 the problem of deciding whether a grammar
-is ambiguous or not is in general undecidable. But in concrete instances we can
-often make a choice.
+is ambiguous or not is in general undecidable. 
+
+Let us now turn to the problem of generating a parse-tree for a grammar and string.
+In what follows we explain \emph{parser combinators}, because they are easy
+to implement and closely resemble grammar rules. Imagine that a grammar
+describes the strings of natural numbers, such as the grammar $N$ shown above.
+For all such strings we want to generate the parse-trees or later on we actually 
+want to extract the meaning of these strings, that is the integers ``behind'' these 
+strings. The parser will therefore be functions of type
+
+\begin{center}
+\texttt{I $\Rightarrow$ (T, I)}
+\end{center}
+
+\noindent 
+that is they take as input something of type \texttt{I}, typically a list of token or a string,
+and return a pair. 
+
+
+
 
 \end{document}