Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
Solution 4

Solution 4

Ratings: (0)|Views: 7 |Likes:
Published by alexandru_bratu_6

More info:

Published by: alexandru_bratu_6 on Jun 05, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/20/2014

pdf

text

original

 
WS 2005/6 Prof. R. Wattenhofer / Thomas Moscibroda / Stefan Schmid
Discrete Event SystemsExercise: Sample Solution
1 Regular and Context-Free Languages
Sometimes, even simple grammars can produce tricky languages. We can interpret the 1sand 2s of the second production rule as opening and closing brackets. Hence,
L
(
G
) consistsof all correct bracket terms where at least one 0 must be in each bracket.
L
(
G
) is not regular. Choose
x
= 1
n
02
n
L
(
G
). Let
x
=
uvw
with
|
uv
|
n
and
|
v
|
>
0(pumping lemma). Because of 
|
uv
| ≤
n
,
uv
is in the first 1
n
of 
x
. According to the pumpinglemma, we have
uv
i
w
L
(
i
0). If we choose
i
= 0 we get 1
k
02
n
/
L
(
k < n
).
Since
every 
regular language is also context-free, we can choose an arbitrary regular language.For example, we can choose the language
L
=
{
0
n
1
,n
1
}
which is clearly regular. Thecorresponding context-free grammar is
0
|
1.
2 Context-Free Grammars
SAS 
|
A , A
0
|
1.
One possible solution is to use three productions: A first one which guarantees that there isat least one ’1’ more; a second one which produces all possible strings with the same numberof ’0’ and ’1’; and finally, a production to add further 1’s at arbitrary places:
1
0
1
|
1
0
|
1
|
3 Pushdown Automata
a)
, 0, 00, ()b) It is unambiguous, i.e., there is a unique derivation tree for each word. Each word
w
=
in
L
(
G
) contains a rightmost 0 or parenthesis expression
(
)
that can be unanimouslyassigned to a
A
in each node of the derivation tree. Due to
SA
, each sequence of 
A
s isunambiguous.c) The following deterministic pushdown automaton does the job:

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->