1 / 25

Bottom up parsing of a PDA for context free grammar Productions: P = E  T | E + T

Bottom up parsing of a PDA for context free grammar Productions: P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9.

maxim
Download Presentation

Bottom up parsing of a PDA for context free grammar Productions: P = E  T | E + T

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. Bottom up parsing of a PDA for context free grammar Productions: P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 This is a nondeterministic PDA that is uses basic math operators. We will check the equation (3 + 4) * 5 to determine if it is part of the language. * This presentation is best viewed in a slide show. All writing in red corresponds to other red writing on the slide (mostly used to show transitions).

  2. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack Z0 The stack Is empty

  3. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack ( Z0 ( is pushed onto the stack

  4. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack 3 ( Z0 3 is pushed onto the stack

  5. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack A ( Z0 3 is popped from the stack and A is pushed

  6. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack F ( Z0 A is popped from the stack and F is pushed

  7. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack T ( Z0 F is popped from the stack and T is pushed

  8. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack E ( Z0 T is popped from the stack and E is pushed

  9. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack + E ( Z0 + is pushed onto the stack

  10. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack 4 + E ( Z0 4 is pushed onto the stack

  11. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack A + E ( Z0 4 is popped from the stack and A is pushed

  12. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack F + E ( Z0 A is popped from the stack and F is pushed

  13. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack T + E ( Z0 F is popped from the stack and T is pushed

  14. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack E ( Z0 T, +, E are popped from the stack and E is pushed

  15. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack ) E ( Z0 ) is pushed

  16. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack F Z0 ( E ) are popped from the stack and F is pushed

  17. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack T Z0 F is popped from the stack and T is pushed

  18. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack * T Z0 * is pushed

  19. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack 5 * T Z0 5 is pushed

  20. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack A * T Z0 5 is popped and A is pushed

  21. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack F * T Z0 A is popped and F is pushed

  22. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack T Z0 F*T is popped and T is pushed

  23. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack E Z0 T is popped and E is pushed

  24. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 Stack Z0 E is popped, Leaving zo on The stack and The process is complete

  25. Bottom up processing of (3+4)*5 P = E  T | E + T T  F | T * F F  A | (E) A  0 | 1 | 2 |…|9 E T F T * F A ) ( E 5 E + T T F F A A 4 3 This is the complete tree that we just parsed from the bottom up.

More Related