• Keine Ergebnisse gefunden

Automaten und formale Sprachen

N/A
N/A
Protected

Academic year: 2021

Aktie "Automaten und formale Sprachen"

Copied!
2
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Universit¨at Duisburg-Essen SS 2012

Ingenieurwissenschaften / Informatik July 2, 2012

Professor: Dr. Sander Bruggink Exercise sheet 10

Teaching assistent: Jan St¨uckrath Deadline: 9 July 2012

Automaten und formale Sprachen

Exercise 29 Constructing pushdown automata (7 points) Let be Σ = {a, b}. Give pushdown automata for the following languages. Comment how your pushdown automata work!

(a) L1 ={(ab)nan|n∈N0} (3 p)

(b) L2 ={anbm |n, m∈N0∧n 6=m} (4 p)

Exercise 30 From pushdown automata to grammars and back (7 points) Let the following context free grammar G= ({S, A, B, C, X, Y},{a, b, c}, P, S) be given, where P is defined as follows:

S →XY X →AXB |ε Y →BY C |ε

A→a B →b C →c

Moreover let the pushdown automatonK = ({z0, z1},{a, b, c},{#,+}, δ, z0,#) be given, where the transition function is defined by:

δ(z0, a,#) ={(z0,##)} δ(z1, b,#) ={(z1,+)}

δ(z0, b,#) ={(z1,+)} δ(z1, c,+) ={(z1, ε)}

For all inputs not defined above it holds thathδ(z, x, Y) = ∅.

(a) Transform the grammarGby means of the procedure presented in the lecture to a push- down automaton K0 which accepts exactly the language generated byG. (3 p)

(b) Transform the pushdown automatonK by means of the procedure presented in the lecture to a contextfree grammar G0 which generates exactly the language accepted byK. (4 p)

Exercise 31 Elimination of useless symbols (6 points) Let G= (V,Σ, P, S) be a context free grammar. We call a variable A∈ V productive if there exists a word w∈Σ with A⇒ w. A variable B ∈V is reachable if there is a word w=αBβ with α, β ∈(V ∪Σ) and S⇒ αBβ.

(a) Describe a procedure which calculates all productive variables of a given grammar and

one that calculates all reachable variables. (4 p)

(b) Let be L(G)6=∅. How do we obtain a grammarG0 equivalent toGwith only productive and reachable variables? Do we obtain G0 by

1) first deleting all non-productive variables and then all non-reachable variables (and the productions containing them) or

2) first deleting all non-reachable variables and then all non-productive variables?

(2 p)

1

(2)

The solutions to this exercise sheet must be submitted before Monday, 9 July 2012 at 16:00.

Put your solutions in the letterbox labeled Automaten und formale Sprachen adjacent to roomlf, or hand them in through the onlinemoodle-platform. If you hand in online, please upload your solutions as a single pdf-file. Your name, student number, group number and the lecture name (“Automaten und formale Sprachen”) must be clearly written on your solutions.

2

Referenzen

ÄHNLICHE DOKUMENTE

1) Geben Sie f¨ ur jedes der W¨ orter a, c und abc jeweils ein weiteres Wort an, das zu dem jeweiligen Wort ¨ aquivalent ist. Geben Sie außerdem ein Wort an, dass zu keinem der..

Put your solutions in the letterbox labeled Automaten und formale Sprachen adjacent to room lf , or hand them in through the online moodle -platform. If you hand in online,

Bitte werfen Sie Ihre Abgabe in den mit Automaten und formale Sprachen beschrifteten Briefkasten neben Raum lf , oder geben Sie sie online ab ¨ uber die moodle-Plattform.. Wenn

Put your solutions in the letterbox labeled Automaten und formale Sprachen adjacent to room lf , or hand them in through the online moodle -platform. If you hand in online,

Bitte werfen Sie Ihre Abgabe in den mit Automaten und formale Sprachen beschrifteten Briefkasten neben Raum lf , oder geben Sie sie online ab ¨ uber die moodle-Plattform.. Wenn

Put your solutions in the letterbox labeled Automaten und formale Sprachen adjacent to room lf , or hand them in through the online moodle -platform.. If you hand in online,

Put your solutions in the letterbox labeled Automaten und formale Sprachen adjacent to room lf , or hand them in through the online moodle -platform. If you hand in online,

Bitte werfen Sie Ihre Abgabe in den mit Automaten und formale Sprachen beschrifteten Briefkasten neben Raum lf  , oder geben Sie sie online ab über die moodle-Plattform. Wenn