1 / 108

CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 8 Mälardalen University

CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 8 Mälardalen University 2010.

Download Presentation

CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 8 Mälardalen University

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 8 Mälardalen University 2010

  2. ContentContext-Free LanguagesPush-Down Automata, PDANPDA: Non-Deterministic PDAFormal Definitions for NPDAs NPDAs Accept Context-Free LanguagesConverting NPDA to Context-Free Grammar

  3. Non-regular languages Context-Free Languages Regular Languages

  4. Context-Free Languages

  5. stack automaton Context-Free Languages Context-Free Grammars Pushdown Automata (CF grammars are defined as generalized Regular Grammars)

  6. is string of variables and terminals Definition: Context-Free Grammars Grammar Variables Terminal symbols Start variables Productions of the form:

  7. is string of terminals Definition: Regular Grammars Grammar Variables Terminal symbols Start variables Right or Left Linear Grammars. Productions of the form: or

  8. Pushdown AutomataPDAs

  9. Pushdown Automaton - PDA Input String Stack States

  10. The Stack A PDA can write symbols on stack and read them later on. POP reading symbol PUSH writing symbol All access to the stack only on the top! (Stack top is written leftmost in the string, e.g. yxz) A stack is valuable as it can hold an unlimitedamount of (certain kind of) information. The stack allows pushdown automata to recognize some non-regular languages.

  11. The States Pop old- reading stack symbol Push new - writing stacksymbol Input symbol

  12. input stack top Replace (An alternative is to start and finish with empty stack or a stack bottom symbol such as $)

  13. stack top Push input

  14. stack top Pop input

  15. input stack top No Change

  16. Example 3.7 Salling: A PDA for simple nested parenthesis strings Time 0 Input Stack

  17. Example 3.7 Time 1 Input Stack

  18. Example 3.7 Time 2 Input Stack

  19. Stack Example 3.7 Time 3 Input

  20. Stack Example 3.7 Time 4 Input

  21. Stack Example 3.7 Time 5 Input

  22. Example 3.7 Time 6 Input Stack

  23. Example 3.7 Time 7 Input Stack

  24. NPDAsNon-deterministic Push-Down Automata

  25. Non-Determinism

  26. A string is accepted if: • All the input is consumed • The last state is a final state • Stack is in the initial condition • (either: empty (when we started with empty stack), • or: bottom symbol reached, or similar)

  27. Example NPDA is the language accepted by the NPDA:

  28. Example NPDA NPDAM (Even-length palindromes)

  29. Pushing Strings Pop symbol Input symbol Push string

  30. Example input pushed string stack top Push

  31. Another NPDA example NPDAM

  32. Execution Example Time 0 Input Stack Current state

  33. Time 1 Input Stack

  34. Time 2 Input Stack

  35. Time 3 Input Stack

  36. Time 4 Input Stack

  37. Time 5 Input Stack

  38. Time 6 Input Stack

  39. Time 7 Input Stack accept

  40. Formal Definitions for NPDAs

  41. Transition function

  42. Transition function new state current state current stack top new stack top current input symbol An unspecified transition function is to the null set and represents a dead configuration for the NPDA.

  43. Final states States Input alphabet Stack start symbol Transition function Stack alphabet Formal Definition Non-Deterministic Pushdown Automaton NPDA

  44. Instantaneous Description Current stack contents Current state Remaining input

  45. Example Instantaneous Description Input Time 4: Stack

  46. Example Instantaneous Description Input Time 5: Stack

  47. We write Time 4 Time 5

  48. A computation example

  49. A computation example

  50. A computation example

More Related