Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. Created by PLY version 3.9 (http://www.dabeaz.com/ply)
  2.  
  3. Grammar
  4.  
  5. Rule 0 S' -> expression
  6. Rule 1 expression -> expression LT expression
  7. Rule 2 expression -> expression LPAREN RPAREN
  8. Rule 3 expression -> NAME
  9.  
  10. Terminals, with rules where they appear
  11.  
  12. LPAREN : 2
  13. LT : 1
  14. NAME : 3
  15. RPAREN : 2
  16. error :
  17.  
  18. Nonterminals, with rules where they appear
  19.  
  20. expression : 1 1 2 0
  21.  
  22. Parsing method: LALR
  23.  
  24. state 0
  25.  
  26. (0) S' -> . expression
  27. (1) expression -> . expression LT expression
  28. (2) expression -> . expression LPAREN RPAREN
  29. (3) expression -> . NAME
  30.  
  31. NAME shift and go to state 2
  32.  
  33. expression shift and go to state 1
  34.  
  35. state 1
  36.  
  37. (0) S' -> expression .
  38. (1) expression -> expression . LT expression
  39. (2) expression -> expression . LPAREN RPAREN
  40.  
  41. LT shift and go to state 4
  42. LPAREN shift and go to state 3
  43.  
  44.  
  45. state 2
  46.  
  47. (3) expression -> NAME .
  48.  
  49. LT reduce using rule 3 (expression -> NAME .)
  50. LPAREN reduce using rule 3 (expression -> NAME .)
  51. $end reduce using rule 3 (expression -> NAME .)
  52.  
  53.  
  54. state 3
  55.  
  56. (2) expression -> expression LPAREN . RPAREN
  57.  
  58. RPAREN shift and go to state 5
  59.  
  60.  
  61. state 4
  62.  
  63. (1) expression -> expression LT . expression
  64. (1) expression -> . expression LT expression
  65. (2) expression -> . expression LPAREN RPAREN
  66. (3) expression -> . NAME
  67.  
  68. NAME shift and go to state 2
  69.  
  70. expression shift and go to state 6
  71.  
  72. state 5
  73.  
  74. (2) expression -> expression LPAREN RPAREN .
  75.  
  76. LT reduce using rule 2 (expression -> expression LPAREN RPAREN .)
  77. LPAREN reduce using rule 2 (expression -> expression LPAREN RPAREN .)
  78. $end reduce using rule 2 (expression -> expression LPAREN RPAREN .)
  79.  
  80.  
  81. state 6
  82.  
  83. (1) expression -> expression LT expression .
  84. (1) expression -> expression . LT expression
  85. (2) expression -> expression . LPAREN RPAREN
  86.  
  87. LT reduce using rule 1 (expression -> expression LT expression .)
  88. LPAREN reduce using rule 1 (expression -> expression LT expression .)
  89. $end reduce using rule 1 (expression -> expression LT expression .)
  90.  
  91. ! LT [ shift and go to state 4 ]
  92. ! LPAREN [ shift and go to state 3 ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement