diff -r 46eee459a999 -r 66adcae6c762 handouts/ho05.tex --- a/handouts/ho05.tex Thu Oct 05 14:36:54 2023 +0100 +++ b/handouts/ho05.tex Fri Oct 13 15:07:37 2023 +0100 @@ -82,7 +82,7 @@ \end{center} \noindent -from natural languages were the meaning of \emph{flies} depends on the +from natural languages where the meaning of \emph{flies} depends on the surrounding \emph{context} are avoided as much as possible. Here is an interesting video about C++ not being a context-free language @@ -368,7 +368,7 @@ \noindent The point is that we can in principle transform every left-recursive -grammar into one that is non-left-recursive one. This explains why often +grammar into one that is non-left-recursive. This explains why often the following grammar is used for arithmetic expressions: \begin{plstx}[margin=1cm] @@ -380,7 +380,7 @@ \noindent In this grammar all $\meta{E}$xpressions, $\meta{T}$erms and $\meta{F}$actors are in some way protected from being -left-recusive. For example if you start $\meta{E}$ you can derive +left-recursive. For example if you start $\meta{E}$ you can derive another one by going through $\meta{T}$, then $\meta{F}$, but then $\meta{E}$ is protected by the open-parenthesis in the last rule. @@ -408,7 +408,7 @@ $\epsilon$-rules from grammars. Consider again the grammar above for binary numbers where have a rule $\meta{B'} ::= \epsilon$. In this case we look for rules of the (generic) form \mbox{$\meta{A} := -\alpha\cdot\meta{B'}\cdot\beta$}. That is there are rules that use +\alpha\cdot\meta{B'}\cdot\beta$}. That is, there are rules that use $\meta{B'}$ and something ($\alpha$) is in front of $\meta{B'}$ and something follows ($\beta$). Such rules need to be replaced by additional rules of the form \mbox{$\meta{A} := \alpha\cdot\beta$}. @@ -419,7 +419,7 @@ : \meta{B} ::= 0 \cdot \meta{B'} | 1 \cdot \meta{B'}\\ \end{plstx} -\noindent To follow the general scheme of the transfromation, +\noindent To follow the general scheme of the transformation, the $\alpha$ is either is either $0$ or $1$, and the $\beta$ happens to be empty. So we need to generate new rules for the form \mbox{$\meta{A} := \alpha\cdot\beta$}, which in our particular