Draw a parse tree for the following derivation: - PowerPoint PPT Presentation

About This Presentation
Title:

Draw a parse tree for the following derivation:

Description:

... heard of the CSCU, check out our webpage (www.cscu.csc. ... Please bring your final exam schedule info to class on Wed. so we can schedule a time for these. ... – PowerPoint PPT presentation

Number of Views:276
Avg rating:3.0/5.0
Slides: 17
Provided by: wendym71
Category:

less

Transcript and Presenter's Notes

Title: Draw a parse tree for the following derivation:


1
  • Draw a parse tree for the following derivation
  • S ? C A C ? C A b b ? b b A b b?
  • b b B b b ? b b a A a a b b
  • ? b b a b a a b b
  • 2. Show on your parse tree u, v, x, y, z as per
    the pumping theorem.
  • 3. Prove that the language for this question is
    an infinite language.

2
A message from Caitlin Blank (secretary of the
Computer Science Course Union) If you haven't
heard of the CSCU, check out our webpage
(www.cscu.csc.uvic.ca) or visit us at ECS 331.
Anyway, we try to make life better by doing
awesome things - among said awesome things is
this year's Halloween Pub Crawl October 30th!
20 gets you into 4 venues (no cover), 3 free
drinks, time at a pool table, karaoke, and even
busses between venues. It's going to be great, so
we hope to see you there! Tickets are on sale
now, so for more information email me
(cblank_at_uvic.ca) or stop by the CSCU Office ECS
331!
3
Assignment 4 is posted due on Tues. Nov. 17 (3
weeks from today). Please start early and do not
leave it to the night before. Tutorials cancelled
this week. The TA will offer an additional
session sometime between Dec. 7-11 to
compensate. Final exam tutorial Monday Dec.
14. Please bring your final exam schedule info to
class on Wed. so we can schedule a time for
these. Reading break Tues./Wed. Nov. 10/11 (no
class) No class on Dec. 4 Memorial service
1130am.
4
Pushdown Automata
Picture from Torsten Schaßan
5
Pushdown Automata A pushdown automaton is like a
NDFA which has a stack. Every context-free
language has a pushdown automaton that accepts
it. This lecture starts with some examples, gives
the formal definition, then investigates PDAs
further.
6
Stacks
7
Stack Data Structure permits push and pop at the
top of the stack.
8
L w c wR w ? a, b
Start state s, Final State t
State Input Pop Next state Push
s a e s A
s b e s B
s c e t e
t a A t e
t b B t e
9
  • To accept, there must exist a computation which
  • Starts in the start state with an empty stack.
  • Applies transitions of the PDA which are
    applicable at each step.
  • Consumes all the input.
  • Terminates in a final state with an empty stack.

10
w a b b c b b a
Stack is knocked over like this



B
B
A
(s, abbcbba, e) (s, cbba, BBA) (t, bba, BBA)
(t, e, e)
B B A
11
A pushdown automaton is a sextuple M (K, S, G,
?, s, F) where K is a finite set of states, S is
an alphabet (the input symbols) G is an alphabet
(the stack symbols) ?, the transition relation,
is a finite subset of ( K x (S? e) x G)
x (K x G) state input pop
next state push
12
A configuration of a PDA is a member of
K x S x
G current state input remaining stack A
configuration (q, s w, a x) (r, w, ßx) if ((q,
s, a ), (r, ß)) ? ?. For M (K, S, G, ?, s, F),
L(M) (the language accepted by M) w ? S
(s, w, e) (f, e, e) for some final state f in
F.
13
L(M) w ? S (s, w, e) (f, e, e) for some
final state f in F.
  • To accept, there must exist a computation which
  • Starts in the start state with an empty stack.
  • Applies transitions of the PDA which are
    applicable at each step.
  • Consumes all the input.
  • Terminates in a final state with an empty stack.

14
PDAs are non-deterministic
L w wR w ? a, b
Start state s, Final State t
State Input Pop Next state Push
s a e s A
s b e s B
s e e t e
t a A t e
t b B t e
Guessing wrong time to switch from s to t gives
non-accepting computations.
15
L w in a, b w has the same number of as
and bs Start state s Final states s
State Input Pop Next state Push
s a e s B
s a A s e
s b e s A
s b B s e
16
L w in a, b w has the same number of as
and bs State state s, Final states f
State Input Pop Next state Push
s e e t X
t a X t BX
t a A t e
t a B t BB
t b X t AX
t b A t AA
t b B t e
t e X f e
A more deterministic solution Stack will never
contain both As and Bs. X- bottom of stack
marker.
Write a Comment
User Comments (0)
About PowerShow.com