CS 154
Intro. to Automata and Complexity Theory
Handout 24
Autumn 2009
David Dill
November 10, 2009
Problem Set 6
Due: November 17, 2009
Homework:
(Total 100 points) Do the following exercises.
Problem 1
[20 points]
This was the example CFG in lecture for regular expressions over the
alphabet Σ =
{
a, b
}
. Rewrite the grammar into an equivalent grammar (i.e.,
one with the same language) that is unambiguous. The resulting grammar
should group operations according to their precedence (
*
should be “stickier”
than
·
, which should be “stickier” than +). Draw the parse tree for (
a
+
b
·
a
)
*
using your new grammar.
R
→ ∅
R
→
e
R
→
a
R
→
b
R
→
R
+
R
R
→
R
·
R
R
→
R
*
R
→
(
R
)
Problem 1’
[20 points]
If you felt that the previous problem was too easy, you can do this one
instead: Give a contextfree grammar for the set of all strings over the al
phabet
{
a, b
}
that are
not
of the form
ww
(i.e, the same string concatenated
with itself). (This is exercise 5.1.1 (c) in the textbook.)
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.
 '08
 Motwani,R
 Formal language, Formal languages, Regular expression, Contextfree grammar, CFL

Click to edit the document details