Part 22 Handouts
Part 22 Handouts
Presented by:
Jaswinder Singh
Department of Computer Science,
Guru Nanak Dev University, Amritsar
continuing 2
Some Languages/Grammars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Pushdown Automata-I . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Pushdown Automata-II . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Pushdown Automata-III . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Pushdown Automata-IV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Pushdown Automata-V . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Pushdown Automata-VI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Pushdown Automata-VII . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
at the end 10
The day ahead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
And Finally .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1
continuing 2 / 12
Some Languages/Grammars
Consider the following languages/grammars:
✔ L = {0n 1n : n ≥ 0}.
✔ L = {wwR : w ∈ {0, 1}∗ }, where wR denotes reverse of w.
✔ The grammar G with productions S → aS|aSbS|ǫ.
✔ The grammar G with productions E → E + E|E ∗ E|(E)|id.
Note 1: All of above are languages/grammars requires to remember some event happened during
processing.
Note 2: They are not regular, obeviousely will not be accepted by automata, because automata has
no memory attached with it.
Automata-XXII Jaswinder Singh,
CSL222: Theory of Computer Science DCS, GND University, – 2 / 12
MCA(FYIC) 4th Semester(2023) Amritsar
Pushdown Automata-I
0 1 1 1 1 ... 0
Input
↑
→
Stack
2
Pushdown Automata-II
✔ A pushdown automaton consists of
1. a finite nonempty set of states denoted by Q, P
2. a finite nonempty set of input symbols denoted by :,
3. a finite nonempty set of pushdown symbols denoted by Γ,
4. a special state called the initial state denoted by q0 ,
5. a special pushdown symbol called the initial symbol on the pushdown store denoted by Z0 .
6. a set of final states, a subset of QP denoted by F , and
7. a transition function δ from Q × ( ∪{ǫ}) × Γ to the set of finite subsets of Q × Γ∗ .
Pushdown Automata-III
P P
Example: Let the PDA A = (Q, , Γ, δ, A, Z0 , F ) where Q = {A, B, C}, = {a, b}, Γ = {X, Z0 }, F = {C} and δ is
given by
Note 1: The (1) and (2) above express push operation, where top of stack symbol is X.
Note 2: In (3) & (4) above ǫ on RHS express pop operation.
Note 3: In (5) above ǫ on the LHS express input has been exhausted.
Note 4: In (5) above Z0 both on the LHS and RHS express neither push nor pop operation.
3
Pushdown Automata-IV
(a,Z0 ,XZ0 )
Pushdown Automata-V
a a a a b b b b
Input
↑
A
→ Z0
Stack
a a a a b b b b
Input
↑
A → X
Z0
Stack
4
Pushdown Automata-VI
a a a a b b b b
Input
↑ → X
A X
Z0
Stack
a a a a b b b b → X
Input
↑ X
A X
Z0
Stack
Pushdown Automata-VII
a a a a b b b b
Input
↑
C
→ Z0
Stack
5
at the end 10 / 12
THANKS