• Aucun résultat trouvé

Cursus: M1, computer-science Code UE: JEIN8602

N/A
N/A
Protected

Academic year: 2022

Partager "Cursus: M1, computer-science Code UE: JEIN8602"

Copied!
3
0
0

Texte intégral

(1)

Cursus: M1, computer-science Code UE: JEIN8602

Subject: Formal languages theory Date: 05 July 2013

Duration: 3H

Documents: authorized

Lectures by: Mr G´eraud S´enizergues

The exercises are independant one from each other.

It is not required to solve all the exercises. Every correct solution to an exercise will give from 4 to 6 marks (depending on the exercise).

Exercice 1 [/4] We consider the following regular expressions:

e

1

:= (ab)

c, e

2

:= (ba)

, e

3

:= ((ab)

c) ∪ (ba)

, e

4

:= (ab)

(c ∪ (ba)

) 1- Give explicitly four words u

1

∈ L

e1

, u

2

∈ L

e2

, u

3

∈ L

e3

, u

4

∈ L

e4

.

2- Fill each cell of the following array with the answer “yes” (resp. “ no”) if the word u of the row belongs to the language defining the column:

u L

e1

L

e2

L

e3

L

e4

c yes no yes yes abc

ba abba ε

(The first row is given as an example; no precise justification is required for this question).

3- Among the four following statements, which ones are true?

L

e3

= L

e4

, L

e2

⊆ L

e1

, L

e2

⊆ L

e3

, L

e3

= L

e1

∪ L

e2

.

For the statements that are false, give a word that witnesses the falsity.

Exercice 2 [/4] Let us consider the regular expression:

e := (ab

c)

ab(a ∪ b)

Construct, by Glushkov’s method, a finite automaton recognizing L

e

.

(2)

Exercice 3 [/5] We consider the finite automaton A described on figure 1. Note that 0 is

0

1

2

3 a

a

b a

b b

c

c

c

Figure 1: finite automaton A the only initial state and 3 is the only final state.

Construct a regular expression for the language L

A

recognized by the automaton A. Explain the successive steps of your construction.

Exercice 4 [/5] We consider the finite automaton B described on figure 2. Note that 0 is

0

1

2

3

4

5

6 7

a b

b b

a a

a

a

b b

b b

a

a

a, b

Figure 2: finite automaton B the initial state and 0, 5 are the final states.

1- Is B deterministic ?

2- Is every state of B accessible ?

3- Is B complete ? Is B minimal ? If not, transform B into a minimal deterministic complete automaton C that recognizes the same language.

2

(3)

Exercice 5 [/6] 1- For each of the following languages over the terminal alphabet {a, b, c, d}, construct a context-free grammar that generates the language L

i

:

L

1

:= {(ab)

n

| n ≥ 0}

L

2

:= {(ab)

n

c

n

| n ≥ 0}

L

3

:= {(ab)

n

c

m

| n ≥ m ≥ 0}

L

4

:= {(ab)

p

c

q

d

r

| q ≥ 0, r ≥ 0, p = q + r}

L

5

:= {(ab)

p

c

q

d

r

| q ≥ 0, r ≥ 0, p ≥ q + r}

2- Construct a non-ambiguous context-free grammar generating the language L

5

.

Exercice 6 [/5] We consider the context-free grammar G := (A, N, R) where A = {a, b}, N = {S, T, U } and R consists of the following five rules:

r1: S → T U r2: T → aT T r3: T → b r4: U → aU T r5: U → bT T

The start symbol of G is S.

1- Show that aabbaabbb ∈ L(G, T ). Give a leftmost derivation from T to aabbaabbb.

Give a rightmost derivation from T to aabbaabbb.

2- Show that aabbaabbbbbb ∈ L(G, S). Give a leftmost derivation from S to aabbaabbbbbb.

Give a derivation-tree for aabbaabbbbbb.

(The student can choose, among the various notions of syntax-tree, abstract syntax-tree, etc...

his/her favorite notion and compute the corresponding tree).

3- What are the productive non-terminals of G ? the useful non-terminals of G ?

4- Is G a simple context-free grammar ? If not, transform G into a simple context-free grammar G

, generating the same language.

3

Références

Documents relatifs

We then eliminate successively states in the ordering: 0, 1, 2, 3.. Hence the Nerode equivalence over Q is just

Automatic language processing : in order to treat natural language text and extract its semantics or to produce some natural language sentence expressing some meaning, the

From now on, we accept as regular expressions, expressions using the usual symbols ∪ (instead of ⊕), · (instead of ⊗), using k-ary notation for the product and for the union

1- For a given language one can build a smaller automaton 2- For a given language one can find easily a non-deterministic automaton, while finding directly a deterministic

The set of regular languages over Σ ∗ is closed under the operations : union, intersection, complement, set-difference.. By Kleene’s theorem we can use, as well, the notion

1- The set of context-free languages over A ∗ is closed under the operations : union, product, star, cross.. 2- If Card (A) ≥ 2, then the set of context-free languages over A ∗ is

Each new line corresponds to a transition : the left-end of the memory is modified, depending on the top(i.e. leftmost symbol) of the stack and on the input-letter. Such an automaton

There exist some programs that try to detect ambiguity and succeed on many grammars ([S. Schmitz, 2006] for example) There are subclasses of c.f. grammars : the simple grammars,