hw08.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Sat, 24 Nov 2012 07:08:51 +0000
changeset 76 373cf55a3ca5
parent 75 898c25a4e399
child 77 49c0beef79a1
permissions -rw-r--r--
tuned

\documentclass{article}
\usepackage{charter}
\usepackage{hyperref}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{automata}

\newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% for definitions

\begin{document}

\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\\
$Stmt$ & $\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.

\end{enumerate}

\end{document}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: