diff -r 0b59588d28d2 -r 85b961f1eee9 hws/hw08.tex --- a/hws/hw08.tex Tue Nov 26 19:54:16 2013 +0000 +++ b/hws/hw08.tex Tue Nov 26 22:45:06 2013 +0000 @@ -13,35 +13,15 @@ \section*{Homework 8} \begin{enumerate} -\item Suppose the following grammar for the WHILE-language: - -\begin{center} -\begin{tabular}{lcl} -$Stmt$ & $\rightarrow$ & $\text{skip}$\\ - & $|$ & $Id := AExp$\\ - & $|$ & $\text{if}\; B\!Exp \;\text{then}\; Block \;\text{else}\; Block$\\ - & $|$ & $\text{while}\; B\!Exp \;\text{do}\; Block$\medskip\\ -$Stmts$ & $\rightarrow$ & $Stmt \;\text{;}\; Stmts$\\ - & $|$ & $Stmt$\medskip\\ -$Block$ & $\rightarrow$ & $\{ Stmts \}$\\ - & $|$ & $Stmt$\medskip\\ -$AExp$ & $\rightarrow$ & $AExp + AExp$\\ - & $|$ & $AExp * AExp$\\ - & $|$ & $( AExp )$\\ - & $|$ & $Num$\\ - & $|$ & $Id$\medskip\\ -$BExp$ & $\rightarrow$ & $AExp = AExp$\\ - & $|$ & $AExp \not= AExp$\\ - & $|$ & $\text{false}$\\ - & $|$ & $\text{true}$\\ - -\end{tabular} -\end{center} - -Transform this grammar into Chomsky normalform. - \item Write a program in the WHILE-language that calculates the factorial function. +\item What optimisations could a compiler perform when compiling a WHILE-program? + +\item What is the main difference between the Java assembler (as processed by Jasmin) and +Java Byte Code? + +\item Parser combinators can directly be given a string as input, without the need of a lexer. What are +the advantages to first lex a string and then feed a sequence of tokens as input to the parser? \end{enumerate} \end{document}