next up previous
Next: Problem 7 - Type Up: Information Science II Previous: Problem 1 - Algorithm

Problem 5 - Compilation

Answer the following questions about the context-free grammar below.

$\displaystyle \begin{tabular}{l}
$S\rightarrow E$ \\
$E\rightarrow E(S)$ \\
$S\rightarrow S+E$ \\
$E\rightarrow i$ \\
\end{tabular}$

$ \Sigma =\{i,+,(,)\}$ is the set of terminal symbols and $ S$ is the starts symbol.
1.
Remove left recursion from this grammar.
2.
Show that the result of 1. is LL(1).
3.
Consider the set

$\displaystyle \begin{tabular}{rcl}
$L = \{ \alpha A a$ & $\vert$ & $S \Rightarr...
...*,$ \\
& & $A \in \{S,E\}, a \in \Sigma, w \in \Sigma^*\}$ \\
\end{tabular}$

as a language over $ \Sigma\cup\{S,E\}$. Construct a deterministic finite automata $ M$ that accepts $ L$.
4.
Prove that $ L$ is equal to the language accepted by $ M$ using the following inductions:


1.
We just have to deal with trivial left-recusions:
2.



Reynald AFFELDT
2000-06-08