Lecture 33 - Exercises
Consider the following grammar in Chomsky Normal Form:
\(S_0 \rightarrow AM \mid AS \mid SA \mid
NB \mid a\)
\(S \rightarrow AM \mid AS \mid SA \mid NB
\mid a\)
\(A \rightarrow AM \mid AS \mid SA \mid NB
\mid a \mid b\)
\(B \rightarrow b\)
\(M \rightarrow SA\)
\(N \rightarrow a\)
- Derive the string \(bba\). How many
steps was your derivation?
- How many steps is any derivation for a string with length \(n\)?
Part B - CFG to PDA
Conversion
- Suppose the above grammar also had the production \(S_0 \rightarrow \epsilon\), which is only
allowed in CNF because \(S_0\) is the
start symbol. What would we need to add to the transition function of
the PDA to make it accept the string \(\epsilon\)?