ECE 468
Problem Set 3: Regular expressions, Finite Automata, Contextfree Grammars, Parsers
1. Give the reduced DFA for the following regular expression:
((
a
*
bcd
)

(
bc
*
d
))
2. For the following subproblems, consider the following contextfree grammar:
S
→
AB
(1)
A
→
xAC
(2)
A
→
λ
(3)
B
→
CBy
(4)
B
→
λ
(5)
C
→
z
(6)
(a) What are the terminals and nonterminals of this language?
Answer
:
V
t
=
{
x, yz
}
and
V
n
=
{
S, A, B, C
}
(b) Describe the strings are generated by this language. Is this a regular language
(
i.e.
, could you write a regular expression that generates this language)?
Answer:
This language generates strings of the form
x
n
z
m
+
n
y
m
. This is not
regular because it requires a potentially unbounded amount of state to track
how many
n
s and
m
s there are.
(c) Show the derivation of the string
xxzzzy
starting from
S
(specify which produc
tion you used at each step), and give the parse tree according to that derivation.
Answer:
I will put a superscript on the production arrow (
⇒
) to denote which
production was used at each step.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '08
 TEST
 Formal language, Regular expression, Formal grammar, Contextfree grammar

Click to edit the document details