CS 126 Lecture T3: Formal Languages
CS126 16-1 Randy Wang
Outline
- Introduction
- Defining grammar
- Type 3 grammars
- Type 2 grammars
- Chomsky hierarchy
- Conclusions
CS 126 Lecture T3: Formal Languages Outline Introduction Defining - - PDF document
CS 126 Lecture T3: Formal Languages Outline Introduction Defining grammar Type 3 grammars Type 2 grammars Chomsky hierarchy Conclusions CS126 16-1 Randy Wang Where We Are T1 - Simplest language generators: regular
CS126 16-1 Randy Wang
CS126 16-2 Randy Wang
powerful machines
CS126 16-3 Randy Wang
alphabet
CS126 16-4 Randy Wang
CS126 16-5 Randy Wang
CS126 16-6 Randy Wang
CS126 16-8 Randy Wang
CS126 16-9 Randy Wang
CS126 16-10 Randy Wang
CS126 16-11 Randy Wang
if (x == 0) { while (y == 1) { if (z > 0) { s = z * 2; } } }
| <iteration-stmt> | ...
Each box is one production.
CS126 16-12 Randy Wang
CS126 16-13 Randy Wang
CS126 16-14 Randy Wang
CS126 16-15 Randy Wang
CS126 16-16 Randy Wang
CS126 16-17 Randy Wang
<A> -> <z>0 <z> -> <A>1 <z> -> ε
ε ε
1
CS126 16-18 Randy Wang
CS126 16-19 Randy Wang
CS126 16-20 Randy Wang
CS126 16-21 Randy Wang
if (x == 0) { while (y == 1) { if (z > 0) { s = z * 2; } } }
| <iteration-stmt> | ...
Each box is one production.
CS126 16-22 Randy Wang
CS126 16-23 Randy Wang
CS126 16-24 Randy Wang
CS126 16-25 Randy Wang
CS126 16-26 Randy Wang
CS126 16-27 Randy Wang
Reproduction Growth
CS126 16-28 Randy Wang
“Production” rules: add one to each segment of my trunk; replace each branch with myself of prev generation
CS126 16-29 Randy Wang
CS126 16-30 Randy Wang
finite representation
authorship? (Is intelligence/art nothing but a set of rules, with some non- determinism thrown in?)
(Is life nothing but a set of rules, with some non-determinism thrown in?)
CS126 16-31 Randy Wang