Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. Grammar:
  2. S ::= a d | A d
  3. A ::= A a | ε
  4.  
  5. Input: ad$
  6.  
  7. Parser:
  8. spawn(L_S, Call { label: L_S, pos: 0 }, 0)
  9. L_S(0)
  10. spawn(L_S_1, Call { label: L_S, pos: 0 }, 0)
  11. spawn(L_S_2_0, Call { label: L_S, pos: 0 }, 0)
  12. L_S_1(0)
  13. ret(Call { label: (L_S), pos: 0 }, 2)
  14. L_S_2_0(0)
  15. call(Call { label: (L_A), pos: 0 }, L_S_2_1, Call { label: (L_S), pos: 0 })
  16. L_A(0)
  17. spawn(L_A_1_0, Call { label: (L_A), pos: 0 }, 0)
  18. spawn(L_A_2, Call { label: (L_A), pos: 0 }, 0)
  19. L_A_1_0(0)
  20. call(Call { label: (L_A), pos: 0 }, L_A_1_1, Call { label: (L_A), pos: 0 })
  21. L_A(0)
  22. spawn(L_A_1_0, Call { label: (L_A), pos: 0 }, 0)
  23. spawn(L_A_2, Call { label: (L_A), pos: 0 }, 0)
  24. L_A_2(0)
  25. ret(Call { label: (L_A), pos: 0 }, 0)
  26. spawn(L_S_2_1, Call { label: (L_S), pos: 0 }, 0)
  27. spawn(L_A_1_1, Call { label: (L_A), pos: 0 }, 0)
  28. L_S_2_1(0)
  29. L_A_1_1(0)
  30. ret(Call { label: (L_A), pos: 0 }, 1)
  31. spawn(L_S_2_1, Call { label: (L_S), pos: 0 }, 1)
  32. spawn(L_A_1_1, Call { label: (L_A), pos: 0 }, 1)
  33. L_S_2_1(1)
  34. ret(Call { label: (L_S), pos: 0 }, 2)
  35. L_A_1_1(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement