• 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 June 18, 2012

Professor: Dr. Sander Bruggink Exercise sheet 8

Teaching assistent: Jan St¨ uckrath Deadline: 25 June 2012

Automaten und formale Sprachen

Exercise 23 Context-free languages and syntax trees (8 points) Let Σ = {a, b}. For each of the following languages give one context-free grammar which generates the language. In addition, give, for each of your grammars, a syntax tree for a word of your choice of length at least 5.

(a) L

1

= {b

m

a

n

b

m

| n, m ∈ N

0

} (2 p)

(b) L

2

= {a

`

b

n

a

m

| `, n, m ∈ N

0

∧ ` = n + m} (3 p)

(c) L

3

= {a

n

b

m

a

m

b

n

| n, m ∈ N ∧ n 6= 0 6= m} (3 p)

Exercise 24 Chomsky normal form (4 points)

Let the context-free grammar G = ({S, A, B}, {a, b, c}, P, S) be given, where P is defined by

S → AB A → aAb | ε B → cB | c

Transform G in a grammar G

0

in Chomsky normal form, such that L(G) = L(G

0

) holds, by applying the procedure presented in the lecture. Indicate intermediate steps after

• removing all ε-productions,

• removing all chain productions,

• adding new non-terminal symbols,

• splitting rights sides, which are too long.

Submissions without intermediate steps do not achieve points!

Exercise 25 CYK algorithm (8 points)

Let the context-free grammar G = ({S, A, B, C, X, Y, Z}, {a, b, c}, P, S) in Chomsky normal form be given, where P is defined by

S → XY A → a B → b

X → AB | AZ Z → XB

Y → c | CY C → c

(a) Give the language L(G), which is constructed by G. (2 p)

(b) Check by means of the CYK algorithm’, whether the following words are in L(G):

• aabccc (3 p)

• aaabbbcc (3 p)

Set up the table of the CYK algorithm and explain the results, which can be read from the table. Submissions without any explanation do not get points!

1

(2)

The solutions to this exercise sheet must be submitted before Monday, 25 June 2012 at 16:00. 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, 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,

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

(c) ”Pump” and ”shrink” the word by doubling and removing parts of the syntax tree. Think about at which position in the word, the last a or the first b