push down automata

Click here to load reader

Upload: somya-bagai

Post on 20-Jun-2015

1.059 views

Category:

Documents


2 download

TRANSCRIPT

  • 1. PUSH DOWN AUTOMATA

2. WHY PDA ? DFAs accept regular languages. We want to design machines similar toDFAs that will accept context-freelanguages and is regular. A finite automation cannot acceptstring of the form (a^n,b^n) as it has toremember the no. of as and sorequires infinite no. of states. 3. POWERS OF PDA This difficulty is avoided by adding a auxiliarymemory in form of stack. It has a read only input tape and input alphabet. Final state control Set of final states Initial state (as in FA) Read write push down store. 4. PDA MODEL 5. FORMAL DEFINATION Finite nonempty set of states Q. Finite non empty set of input symbols denotedby Finite non empty set of pushdown store Initial state q0. Initial symbol of push down store Z0. Set of final state a transition function .A PDA IS A 7 TUPLE ,NAMELY ),0,0,,,,( FZqQ 6. FORMAL DEFINATION OF CFGA context-free grammar G is a 4-tuple(V, , R, S), where: V is a finite set; each element v V is called a non-terminal character or a variable. is a finite set of terminals, disjoint from , whichmake up the actual content of the sentence. R is a finite relation from V to (V U )* . S, the start symbol, used to represent the wholesentence (or program). It must be an element of V. 7. FORMAL CONTRUCTIONLet G = (V, T,R, S) be a CFG. The PDA P = ({q}, T,V T, , q, S)where the is defined as follows: For each variable A,R1: (q, ,A) = {(q, ) | A is a production ofR} For each terminal aR2: (q, a, a) = {(q, )}* DENOTES NULL 8. PROJECTCONTRUCT PDA EQUIVALENT TO FOLLOWINGGRAMMAR WITH PRODUCTIONS.S -> a AAS -> a SA -> b SA -> aConvert to PDA using LL.Show simulations 9. Step 1: Select GRAMMAR 10. STEP 2:Write the productionsSTEP 3 : Covert ->PDA ( LL) 11. OUTPUT : 12. Construct CFG TO PDAWe define PDA A asis defined by following rules:),,,},,,,{},,{},({ SqbaASbaqA )},{(),,(:4)},{(),,(:3)},{(),,(:2)},(),,(),,{(),,(:1qbbqRqaaqRaqAqRbSqaSqaAAqSqR 13. TEST FOR STRING aabaaa),,(*),,(),,(),,(),,(),,(),,(),,(),,(),,(),,(qaaaaqAAaaqaAAaaaqSaaaqbSbaaaqSbaaaqaSabaaaqSabaaaqaSaabaaaqSaabaaaq 14. THANK YOU