ContextFree Languages 1 Regular Languages 2 ContextFree Languages
















































- Slides: 48

Context-Free Languages 1

Regular Languages 2

Context-Free Languages Regular Languages 3

Context-Free Languages Context-Free Grammars Pushdown Automata stack automaton 4

Context-Free Grammars 5

Example A context-free grammar : A derivation: 6

A context-free grammar : Another derivation: 7


Example A context-free grammar : A derivation: 9

A context-free grammar : Another derivation: 10

11

Example A context-free grammar : A derivation: 12

A context-free grammar : A derivation: 13


Definition: Context-Free Grammars Grammar Variables Terminal symbols Start variables Productions of the form: is string of variables and terminals 15

Definition: Context-Free Languages A language is context-free if and only if there is a grammar with 16

Derivation Order Leftmost derivation: Rightmost derivation: 17

Leftmost derivation: Rightmost derivation: 18

Derivation Trees 19

20

21

22

23

Derivation Tree 24

Derivation Tree yield 25

Partial Derivation Trees Partial derivation tree 26

Partial derivation tree 27

sentential form Partial derivation tree yield 28

Sometimes, derivation order doesn’t matter Leftmost: Rightmost: Same derivation tree 29

Ambiguity 30

leftmost derivation 31

leftmost derivation 32

Two derivation trees 33

The grammar is ambiguous: string has two derivation trees 34

The grammar is ambiguous: string has two leftmost derivations 35

Definition: A context-free grammar if some string is ambiguous has: two or more derivation trees 36

In other words: A context-free grammar if some string is ambiguous has: two or more leftmost derivations (or rightmost) 37

Why do we care about ambiguity? take 38

39

40

Correct result: 41

• Ambiguity is bad for programming languages • We want to remove ambiguity 42

We fix the ambiguous grammar: New non-ambiguous grammar: 43

44

Unique derivation tree 45

The grammar : is non-ambiguous: Every string has a unique derivation tree 46

Inherent Ambiguity Some context free languages have only ambiguous grammars Example: 47

The string has two derivation trees 48
Every linear grammar generates a regular language
Regular and irregular languages
Pumping lemma non regular languages examples
Decision properties of regular languages
Proof by contradiction examples
Decision properties of regular languages
Decision properties of regular languages
Right linear grammar to left linear grammar
Decision properties of regular language
Properties of regular languages
Closure properties of regular languages
Perl
Lateral area of a regular pyramid
Convex polygon example
Right regular solids
9-2 developing formulas for circles and regular polygons
Irregular verbs principal parts
The trampoline shown is shaped like a regular dodecagon
Geometry area of regular polygons
Define regular polyhedron
Deseja se cimentar um quintal quadrado com lados medindo 8m
Surface area of regular tetrahedron
Areas of regular polygons and composite figures
Preterite regular verbs
Symmetry of regular octagon
Technical drawing isometric projection
Polygram theorem
World history semester 2 exam review
Simple squamos
Modifying comparatives
Polygon with 4 sides
Present simple ed
Conjugation of ir verbs in french
Area de un trapecio regular
Qué son emociones
Present simple regular
Ekivalensi
Formas naturais e artificiais
Fsmtoregexheuristic algorithm
Present perfect regular
Cuerpo
Dense irregular connective tissue
Parthenocarpic fruit
Preterite pronounce
Aturan produksi
Traçado urbano irregular
Irregular verbs 50
Regular language
A language is regular if and only if *