Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

From Context-Free Grammars to Pushdown Automata: Understanding the Process, Slides of Computer Science

How to convert context-free grammars (cfgs) into pushdown automata (pdas), a type of automaton used to recognize the languages defined by cfgs. The process involves recognizing recursive procedures in cfgs and carrying out recursive computations on a stack. The document also provides examples and instructions on how to recognize certain strings using a stack.

Typology: Slides

2012/2013

Uploaded on 04/25/2013

rajnikanth
rajnikanth 🇮🇳

4.3

(32)

135 documents

1 / 45

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
Pushdown Stack Automata
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d

Partial preview of the text

Download From Context-Free Grammars to Pushdown Automata: Understanding the Process and more Slides Computer Science in PDF only on Docsity!

1

Pushdown Stack Automata

2

Agenda

Pushdown Automata

 Stacks and recursiveness

 Formal Definition

18

By general principles, can carry out any

recursive computation on a stack. Can do it on a restricted version of an activation record stack, called a “ P ush d own (Stack) A utomaton” or PDA for short.

Q: What is the language generated by

S  # | aSa | bSb?

19

A: Palindromes in {a,b,#}* containing

exactly one #-symbol.

Q: Using a stack, how can we recognize

such strings?

21

PUSH

POP

read a or b?

Push it

ACCEPT

read #? (ignore stack)

read == peek? Pop Else: CRASH!

empty stack?

22

PUSH

POP

read a or b?

Push it

ACCEPT

read #? (ignore stack)

read == peek? Pop Else: CRASH!

empty stack?

Input:

aaab#baa

24

PUSH

POP

read a or b?

Push it

ACCEPT

read #? (ignore stack)

read == peek? Pop Else: CRASH!

empty stack?

a a

Input:

aaab#baa

25

PUSH

POP

read a or b?

Push it

ACCEPT

read #? (ignore stack)

read == peek? Pop Else: CRASH!

empty stack?

a a a

Input:

aaab#baa

27

PUSH

POP

read a or b?

Push it

ACCEPT

read #? (ignore stack)

read == peek? Pop Else: CRASH!

empty stack?

b a a a

Input:

aaab#baa

28

PUSH

POP

read a or b?

Push it

ACCEPT

read #? (ignore stack)

read == peek? Pop Else: CRASH!

empty stack?

a a a

Input:

aaab#baa

30

PUSH

POP

read a or b?

Push it

ACCEPT

read #? (ignore stack)

read == peek? Pop Else: CRASH!

empty stack?

a

Input:

aaab#baa REJECT (nonempty stack)

31

PUSH

POP

read a or b?

Push it

ACCEPT

read #? (ignore stack)

read == peek? Pop Else: CRASH!

empty stack?

a a

Input:

aaab#baaa

33

PUSH

POP

read a or b?

Push it

ACCEPT

read #? (ignore stack)

read == peek? Pop Else: CRASH!

empty stack?

Input:

aaab#baaa Pause input

34

PUSH

POP

read a or b?

Push it

ACCEPT

read #? (ignore stack)

read == peek? Pop Else: CRASH!

empty stack?

Input:

aaab#baaa ACCEPT