--- a/hws/hw05.tex Mon Oct 02 23:10:56 2023 +0100
+++ b/hws/hw05.tex Tue Oct 03 14:29:12 2023 +0100
@@ -118,7 +118,30 @@
Describe which language is generated by this grammar.
+\item Remember we have specified identifiers with regular expressions as
+ strings that start with a letter followed by letters, digits and
+ underscores. This can also be specified by a grammar rule or rules.
+ What would the rule(s) look like for identifiers?
+ \solution{
+ \begin{plstx}[margin=1cm]
+ : \meta{Id\/} ::= \meta{Let\/}\cdot \meta{R}\\
+ : \meta{Let\/} ::= a \;\mid\; \dots \;\mid\; z\\
+ : \meta{Dig\/} ::= 0 \;\mid\; \dots \;\mid\; 9\\
+ : \meta{R\/} ::= \meta{Let\/} \cdot \meta{R\/} \;\mid\;
+ \meta{Dig\/} \cdot \meta{R\/} \;\mid\;
+ $\_$ \cdot \meta{R\/} \;\mid\; \epsilon\\
+ \end{plstx}
+}
+
+\item If we specify keywords, identifiers (see above) and programs
+ by grammar rules, are there any problems you need to be careful
+ about when using a parser for identifying tokens?
+
+ \solution{Parsers do not have the POSIX rules (e.g.~longest munch
+ rule) built in. I am not aware that any parser does this out of
+ the box and you would need to build in such constraints into the
+ grammar rules or parsing mechanism.}
\item {\bf(Optional)} Recall the definitions for $Der$ and $der$
from the lectures. Prove by induction on $r$ the