antelope 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/antelope.gemspec +0 -2
  4. data/bin/antelope +3 -20
  5. data/examples/deterministic.output +97 -103
  6. data/examples/example.ace +0 -1
  7. data/examples/example.output +259 -333
  8. data/examples/simple.output +85 -87
  9. data/lib/antelope/ace/compiler.rb +14 -16
  10. data/lib/antelope/ace/errors.rb +9 -3
  11. data/lib/antelope/ace/grammar/generation.rb +38 -7
  12. data/lib/antelope/ace/grammar/precedences.rb +59 -0
  13. data/lib/antelope/ace/grammar/production.rb +24 -25
  14. data/lib/antelope/ace/grammar/productions.rb +8 -8
  15. data/lib/antelope/ace/grammar.rb +3 -3
  16. data/lib/antelope/ace/{presidence.rb → precedence.rb} +11 -11
  17. data/lib/antelope/ace/scanner/second.rb +2 -2
  18. data/lib/antelope/ace/token.rb +1 -1
  19. data/lib/antelope/ace.rb +2 -2
  20. data/lib/antelope/cli.rb +33 -0
  21. data/lib/antelope/errors.rb +6 -0
  22. data/lib/antelope/generation/constructor/first.rb +40 -6
  23. data/lib/antelope/generation/constructor/follow.rb +83 -25
  24. data/lib/antelope/generation/constructor/nullable.rb +24 -2
  25. data/lib/antelope/generation/constructor.rb +39 -13
  26. data/lib/antelope/generation/errors.rb +15 -0
  27. data/lib/antelope/generation/recognizer/rule.rb +111 -11
  28. data/lib/antelope/generation/recognizer/state.rb +53 -5
  29. data/lib/antelope/generation/recognizer.rb +31 -1
  30. data/lib/antelope/generation/tableizer.rb +42 -10
  31. data/lib/antelope/generation.rb +1 -1
  32. data/lib/antelope/generator/templates/output.erb +19 -18
  33. data/lib/antelope/version.rb +1 -1
  34. data/lib/antelope.rb +3 -2
  35. metadata +7 -36
  36. data/lib/antelope/ace/grammar/presidence.rb +0 -59
  37. data/lib/antelope/automaton.rb +0 -36
  38. data/lib/antelope/generation/conflictor/conflict.rb +0 -7
  39. data/lib/antelope/generation/conflictor.rb +0 -45
  40. data/lib/antelope/generation/constructor/lookahead.rb +0 -42
@@ -1,70 +1,68 @@
1
1
  Productions:
2
- 0/n0: $start(0) expression(0:1) $
3
- 1/n1: expression(13:19)NUMBER
4
- 2/l2: expression(13:19) → expression(0:1) "+" expression(10:16)
5
- 3/l2: expression(13:19) → expression(0:1) "-" expression(11:17)
6
- 4/l3: expression(13:19) → expression(0:1) "*" expression(12:18)
7
- 5/l3: expression(13:19)expression(0:1) "/" expression(13:19)
8
- 6/n4: expression(13:19) → "(" expression(7:14) ")"
9
- 7/n4: expression(13:19) "(" $error ")"
10
- 20/l2: expression(13:19) → expression(7:14) "+" expression(10:16)
11
- 21/l2: expression(13:19) → expression(7:14) "-" expression(11:17)
12
- 22/l3: expression(13:19) → expression(7:14) "*" expression(12:18)
13
- 23/l3: expression(13:19) → expression(7:14) "/" expression(13:19)
14
- 31/l2: expression(13:19) → expression(10:16) "+" expression(10:16)
15
- 32/l2: expression(13:19) → expression(10:16) "-" expression(11:17)
16
- 33/l3: expression(13:19) → expression(10:16) "*" expression(12:18)
17
- 34/l3: expression(13:19) → expression(10:16) "/" expression(13:19)
18
- 39/l2: expression(13:19) → expression(11:17) "+" expression(10:16)
19
- 40/l2: expression(13:19) → expression(11:17) "-" expression(11:17)
20
- 41/l3: expression(13:19) → expression(11:17) "*" expression(12:18)
21
- 42/l3: expression(13:19) → expression(11:17) "/" expression(13:19)
22
- 47/l2: expression(13:19) → expression(12:18) "+" expression(10:16)
23
- 48/l2: expression(13:19) → expression(12:18) "-" expression(11:17)
24
- 49/l3: expression(13:19) → expression(12:18) "*" expression(12:18)
25
- 50/l3: expression(13:19) → expression(12:18) "/" expression(13:19)
26
- 55/l2: expression(13:19) → expression(13:19) "+" expression(10:16)
27
- 56/l2: expression(13:19) → expression(13:19) "-" expression(11:17)
28
- 57/l3: expression(13:19) → expression(13:19) "*" expression(12:18)
29
- 58/l3: expression(13:19) → expression(13:19) "/" expression(13:19)
30
-
31
- Original Productions:
32
- expression → NUMBER
33
- { |a| a[1] }
34
- expression → expression "+" expression
35
- { |a, _, b| a + b }
36
- expression → expression "-" expression
37
- { |a, _, b| a - b }
38
- expression → expression "*" expression
39
- { |a, _, b| a * b }
40
- expression → expression "/" expression
41
- { |a, _, b| a / b }
42
- expression → "(" expression ")"
43
- { |_, a, _| a }
44
- expression → "(" $error ")"
45
-
46
- $start → expression $
47
-
48
-
49
- Conflicts:
50
- State 16:
51
- rules : 68
52
- type : shift_reduce
53
- tokens: {"+", "-", "*", "/", ")", $}
54
- State 17:
55
- rules : 74
56
- type : shift_reduce
57
- tokens: {"+", "-", "*", "/", ")", $}
58
- State 18:
59
- rules : 80
60
- type : shift_reduce
61
- tokens: {"+", "-", "*", "/", ")", $}
62
- State 19:
63
- rules : 86
64
- type : shift_reduce
65
- tokens: {"+", "-", "*", "/", ")", $}
66
-
67
- Presidence:
2
+ expressionNUMBER { |a| a[1] }
3
+ expression → expression "+" expression { |a, _, b| a + b }
4
+ expression → expression "-" expression { |a, _, b| a - b }
5
+ expression → expression "*" expression { |a, _, b| a * b }
6
+ expression → expression "/" expression { |a, _, b| a / b }
7
+ expression → "(" expression ")" { |_, a, _| a }
8
+ expression → "(" $error ")"
9
+ $startexpression $
10
+
11
+ Productions, Again:
12
+ 0/n0: $start(0) → expression(0:1) $
13
+ 1/n1: expression(0:1) → NUMBER
14
+ 2/l2: expression(0:1) → expression(0:1) "+" expression(10:16)
15
+ 3/l2: expression(0:1) → expression(0:1) "-" expression(11:17)
16
+ 4/l3: expression(0:1) → expression(0:1) "*" expression(12:18)
17
+ 5/l3: expression(0:1) → expression(0:1) "/" expression(13:19)
18
+ 6/n4: expression(0:1) → "(" expression(7:14) ")"
19
+ 7/n4: expression(0:1) → "(" $error ")"
20
+ 19/n1: expression(7:14) → NUMBER
21
+ 20/l2: expression(7:14) → expression(7:14) "+" expression(10:16)
22
+ 21/l2: expression(7:14) → expression(7:14) "-" expression(11:17)
23
+ 22/l3: expression(7:14) → expression(7:14) "*" expression(12:18)
24
+ 23/l3: expression(7:14) → expression(7:14) "/" expression(13:19)
25
+ 24/n4: expression(7:14) → "(" expression(7:14) ")"
26
+ 25/n4: expression(7:14) → "(" $error ")"
27
+ 30/n1: expression(10:16) → NUMBER
28
+ 31/l2: expression(10:16) → expression(10:16) "+" expression(10:16)
29
+ 32/l2: expression(10:16) → expression(10:16) "-" expression(11:17)
30
+ 33/l3: expression(10:16) → expression(10:16) "*" expression(12:18)
31
+ 34/l3: expression(10:16) → expression(10:16) "/" expression(13:19)
32
+ 35/n4: expression(10:16)"(" expression(7:14) ")"
33
+ 36/n4: expression(10:16) → "(" $error ")"
34
+ 38/n1: expression(11:17)NUMBER
35
+ 39/l2: expression(11:17) expression(11:17) "+" expression(10:16)
36
+ 40/l2: expression(11:17) → expression(11:17) "-" expression(11:17)
37
+ 41/l3: expression(11:17) expression(11:17) "*" expression(12:18)
38
+ 42/l3: expression(11:17) → expression(11:17) "/" expression(13:19)
39
+ 43/n4: expression(11:17) "(" expression(7:14) ")"
40
+ 44/n4: expression(11:17)"(" $error ")"
41
+ 46/n1: expression(12:18) NUMBER
42
+ 47/l2: expression(12:18)expression(12:18) "+" expression(10:16)
43
+ 48/l2: expression(12:18) expression(12:18) "-" expression(11:17)
44
+ 49/l3: expression(12:18)expression(12:18) "*" expression(12:18)
45
+ 50/l3: expression(12:18) → expression(12:18) "/" expression(13:19)
46
+ 51/n4: expression(12:18) "(" expression(7:14) ")"
47
+ 52/n4: expression(12:18) → "(" $error ")"
48
+ 54/n1: expression(13:19) → NUMBER
49
+ 55/l2: expression(13:19) → expression(13:19) "+" expression(10:16)
50
+ 56/l2: expression(13:19) → expression(13:19) "-" expression(11:17)
51
+ 57/l3: expression(13:19) → expression(13:19) "*" expression(12:18)
52
+ 58/l3: expression(13:19) → expression(13:19) "/" expression(13:19)
53
+ 59/n4: expression(13:19) "(" expression(7:14) ")"
54
+ 60/n4: expression(13:19) → "(" $error ")"
55
+
56
+ FOLLOW:
57
+ $start(0): {}
58
+ expression(0:1): {$, "+", "-", "*", "/"}
59
+ expression(7:14): {")", "+", "-", "*", "/"}
60
+ expression(10:16): {$, "+", "-", "*", "/", ")"}
61
+ expression(11:17): {$, "+", "-", "*", "/", ")"}
62
+ expression(12:18): {$, "+", "-", "*", "/", ")"}
63
+ expression(13:19): {$, "+", "-", "*", "/", ")"}
64
+
65
+ Precedence:
68
66
  --- highest
69
67
  nonassoc 4:
70
68
  {LPAREN, RPAREN}
@@ -79,198 +77,126 @@ Presidence:
79
77
  --- lowest
80
78
 
81
79
  Table:
82
- {0=>{:expression=>[:state, 1], :NUMBER=>[:state, 2], :LPAREN=>[:state, 7]},
83
- 1=>
84
- {:"$"=>[:state, 9],
85
- :ADD=>[:state, 10],
86
- :SUBTRACT=>[:state, 11],
87
- :MULTIPLY=>[:state, 12],
88
- :DIVIDE=>[:state, 13]},
89
- 2=>
90
- {:ADD=>[:reduce, 1],
91
- :SUBTRACT=>[:reduce, 1],
92
- :MULTIPLY=>[:reduce, 1],
93
- :DIVIDE=>[:reduce, 1],
94
- :RPAREN=>[:reduce, 1],
95
- :"$"=>[:reduce, 1]},
96
- 3=>{:ADD=>[:state, 10]},
97
- 4=>{:SUBTRACT=>[:state, 11]},
98
- 5=>{:MULTIPLY=>[:state, 12]},
99
- 6=>{:DIVIDE=>[:state, 13]},
100
- 7=>
101
- {:expression=>[:state, 14],
102
- :NUMBER=>[:state, 2],
103
- :LPAREN=>[:state, 7],
104
- :$error=>[:state, 15]},
105
- 8=>{:$error=>[:state, 15]},
106
- 9=>{:"$"=>[:accept, 0]},
107
- 10=>{:expression=>[:state, 16], :NUMBER=>[:state, 2], :LPAREN=>[:state, 7]},
108
- 11=>{:expression=>[:state, 17], :NUMBER=>[:state, 2], :LPAREN=>[:state, 7]},
109
- 12=>{:expression=>[:state, 18], :NUMBER=>[:state, 2], :LPAREN=>[:state, 7]},
110
- 13=>{:expression=>[:state, 19], :NUMBER=>[:state, 2], :LPAREN=>[:state, 7]},
111
- 14=>
112
- {:"$"=>[:state, 9],
113
- :ADD=>[:state, 10],
114
- :SUBTRACT=>[:state, 11],
115
- :MULTIPLY=>[:state, 12],
116
- :DIVIDE=>[:state, 13],
117
- :RPAREN=>[:state, 20]},
118
- 15=>{:RPAREN=>[:state, 21]},
119
- 16=>
120
- {:"$"=>[:reduce, 2],
121
- :ADD=>[:reduce, 2],
122
- :SUBTRACT=>[:reduce, 2],
123
- :MULTIPLY=>[:state, 12],
124
- :DIVIDE=>[:state, 13],
125
- :RPAREN=>[:reduce, 2]},
126
- 17=>
127
- {:"$"=>[:reduce, 3],
128
- :ADD=>[:reduce, 3],
129
- :SUBTRACT=>[:reduce, 3],
130
- :MULTIPLY=>[:state, 12],
131
- :DIVIDE=>[:state, 13],
132
- :RPAREN=>[:reduce, 3]},
133
- 18=>
134
- {:"$"=>[:reduce, 4],
135
- :ADD=>[:reduce, 4],
136
- :SUBTRACT=>[:reduce, 4],
137
- :MULTIPLY=>[:reduce, 4],
138
- :DIVIDE=>[:reduce, 4],
139
- :RPAREN=>[:reduce, 4]},
140
- 19=>
141
- {:"$"=>[:reduce, 5],
142
- :ADD=>[:reduce, 5],
143
- :SUBTRACT=>[:reduce, 5],
144
- :MULTIPLY=>[:reduce, 5],
145
- :DIVIDE=>[:reduce, 5],
146
- :RPAREN=>[:reduce, 5]},
147
- 20=>
148
- {:ADD=>[:reduce, 6],
149
- :SUBTRACT=>[:reduce, 6],
150
- :MULTIPLY=>[:reduce, 6],
151
- :DIVIDE=>[:reduce, 6],
152
- :RPAREN=>[:reduce, 6],
153
- :"$"=>[:reduce, 6]},
154
- 21=>
155
- {:ADD=>[:reduce, 7],
156
- :SUBTRACT=>[:reduce, 7],
157
- :MULTIPLY=>[:reduce, 7],
158
- :DIVIDE=>[:reduce, 7],
159
- :RPAREN=>[:reduce, 7],
160
- :"$"=>[:reduce, 7]}}
161
-
162
- [#<Antelope::Generation::Recognizer::Rule id=0 left=$start(0) right=[expression(0:1) $] position=0>,
163
- #<Antelope::Generation::Recognizer::Rule id=1 left=expression(13:19) right=[NUMBER] position=0>,
164
- #<Antelope::Generation::Recognizer::Rule id=2 left=expression(13:19) right=[expression(0:1) "+" expression(10:16)] position=0>,
165
- #<Antelope::Generation::Recognizer::Rule id=3 left=expression(13:19) right=[expression(0:1) "-" expression(11:17)] position=0>,
166
- #<Antelope::Generation::Recognizer::Rule id=4 left=expression(13:19) right=[expression(0:1) "*" expression(12:18)] position=0>,
167
- #<Antelope::Generation::Recognizer::Rule id=5 left=expression(13:19) right=[expression(0:1) "/" expression(13:19)] position=0>,
168
- #<Antelope::Generation::Recognizer::Rule id=6 left=expression(13:19) right=["(" expression(7:14) ")"] position=0>,
169
- #<Antelope::Generation::Recognizer::Rule id=7 left=expression(13:19) right=["(" $error ")"] position=0>,
170
- nil,
171
- nil,
172
- nil,
173
- nil,
174
- nil,
175
- #<Antelope::Generation::Recognizer::Rule id=13 left=expression(13:19) right=[NUMBER] position=1>,
176
- nil,
177
- nil,
178
- nil,
179
- nil,
180
- #<Antelope::Generation::Recognizer::Rule id=18 left=expression(13:19) right=["(" expression ")"] position=1>,
181
- #<Antelope::Generation::Recognizer::Rule id=19 left=expression(13:19) right=[NUMBER] position=0>,
182
- #<Antelope::Generation::Recognizer::Rule id=20 left=expression(13:19) right=[expression(7:14) "+" expression(10:16)] position=0>,
183
- #<Antelope::Generation::Recognizer::Rule id=21 left=expression(13:19) right=[expression(7:14) "-" expression(11:17)] position=0>,
184
- #<Antelope::Generation::Recognizer::Rule id=22 left=expression(13:19) right=[expression(7:14) "*" expression(12:18)] position=0>,
185
- #<Antelope::Generation::Recognizer::Rule id=23 left=expression(13:19) right=[expression(7:14) "/" expression(13:19)] position=0>,
186
- #<Antelope::Generation::Recognizer::Rule id=24 left=expression(13:19) right=["(" expression(7:14) ")"] position=0>,
187
- #<Antelope::Generation::Recognizer::Rule id=25 left=expression(13:19) right=["(" $error ")"] position=0>,
188
- nil,
189
- #<Antelope::Generation::Recognizer::Rule id=27 left=expression(13:19) right=["(" $error ")"] position=1>,
190
- #<Antelope::Generation::Recognizer::Rule id=28 left=$start(0) right=[expression $] position=2>,
191
- #<Antelope::Generation::Recognizer::Rule id=29 left=expression(13:19) right=[expression "+" expression] position=2>,
192
- #<Antelope::Generation::Recognizer::Rule id=30 left=expression(13:19) right=[NUMBER] position=0>,
193
- #<Antelope::Generation::Recognizer::Rule id=31 left=expression(13:19) right=[expression(10:16) "+" expression(10:16)] position=0>,
194
- #<Antelope::Generation::Recognizer::Rule id=32 left=expression(13:19) right=[expression(10:16) "-" expression(11:17)] position=0>,
195
- #<Antelope::Generation::Recognizer::Rule id=33 left=expression(13:19) right=[expression(10:16) "*" expression(12:18)] position=0>,
196
- #<Antelope::Generation::Recognizer::Rule id=34 left=expression(13:19) right=[expression(10:16) "/" expression(13:19)] position=0>,
197
- #<Antelope::Generation::Recognizer::Rule id=35 left=expression(13:19) right=["(" expression(7:14) ")"] position=0>,
198
- #<Antelope::Generation::Recognizer::Rule id=36 left=expression(13:19) right=["(" $error ")"] position=0>,
199
- #<Antelope::Generation::Recognizer::Rule id=37 left=expression(13:19) right=[expression "-" expression] position=2>,
200
- #<Antelope::Generation::Recognizer::Rule id=38 left=expression(13:19) right=[NUMBER] position=0>,
201
- #<Antelope::Generation::Recognizer::Rule id=39 left=expression(13:19) right=[expression(11:17) "+" expression(10:16)] position=0>,
202
- #<Antelope::Generation::Recognizer::Rule id=40 left=expression(13:19) right=[expression(11:17) "-" expression(11:17)] position=0>,
203
- #<Antelope::Generation::Recognizer::Rule id=41 left=expression(13:19) right=[expression(11:17) "*" expression(12:18)] position=0>,
204
- #<Antelope::Generation::Recognizer::Rule id=42 left=expression(13:19) right=[expression(11:17) "/" expression(13:19)] position=0>,
205
- #<Antelope::Generation::Recognizer::Rule id=43 left=expression(13:19) right=["(" expression(7:14) ")"] position=0>,
206
- #<Antelope::Generation::Recognizer::Rule id=44 left=expression(13:19) right=["(" $error ")"] position=0>,
207
- #<Antelope::Generation::Recognizer::Rule id=45 left=expression(13:19) right=[expression "*" expression] position=2>,
208
- #<Antelope::Generation::Recognizer::Rule id=46 left=expression(13:19) right=[NUMBER] position=0>,
209
- #<Antelope::Generation::Recognizer::Rule id=47 left=expression(13:19) right=[expression(12:18) "+" expression(10:16)] position=0>,
210
- #<Antelope::Generation::Recognizer::Rule id=48 left=expression(13:19) right=[expression(12:18) "-" expression(11:17)] position=0>,
211
- #<Antelope::Generation::Recognizer::Rule id=49 left=expression(13:19) right=[expression(12:18) "*" expression(12:18)] position=0>,
212
- #<Antelope::Generation::Recognizer::Rule id=50 left=expression(13:19) right=[expression(12:18) "/" expression(13:19)] position=0>,
213
- #<Antelope::Generation::Recognizer::Rule id=51 left=expression(13:19) right=["(" expression(7:14) ")"] position=0>,
214
- #<Antelope::Generation::Recognizer::Rule id=52 left=expression(13:19) right=["(" $error ")"] position=0>,
215
- #<Antelope::Generation::Recognizer::Rule id=53 left=expression(13:19) right=[expression "/" expression] position=2>,
216
- #<Antelope::Generation::Recognizer::Rule id=54 left=expression(13:19) right=[NUMBER] position=0>,
217
- #<Antelope::Generation::Recognizer::Rule id=55 left=expression(13:19) right=[expression(13:19) "+" expression(10:16)] position=0>,
218
- #<Antelope::Generation::Recognizer::Rule id=56 left=expression(13:19) right=[expression(13:19) "-" expression(11:17)] position=0>,
219
- #<Antelope::Generation::Recognizer::Rule id=57 left=expression(13:19) right=[expression(13:19) "*" expression(12:18)] position=0>,
220
- #<Antelope::Generation::Recognizer::Rule id=58 left=expression(13:19) right=[expression(13:19) "/" expression(13:19)] position=0>,
221
- #<Antelope::Generation::Recognizer::Rule id=59 left=expression(13:19) right=["(" expression(7:14) ")"] position=0>,
222
- #<Antelope::Generation::Recognizer::Rule id=60 left=expression(13:19) right=["(" $error ")"] position=0>,
223
- #<Antelope::Generation::Recognizer::Rule id=61 left=expression(13:19) right=["(" expression ")"] position=2>,
224
- nil,
225
- nil,
226
- nil,
227
- nil,
228
- nil,
229
- #<Antelope::Generation::Recognizer::Rule id=67 left=expression(13:19) right=["(" $error ")"] position=2>,
230
- #<Antelope::Generation::Recognizer::Rule id=68 left=expression(13:19) right=[expression "+" expression] position=3>,
231
- nil,
232
- nil,
233
- nil,
234
- nil,
235
- nil,
236
- #<Antelope::Generation::Recognizer::Rule id=74 left=expression(13:19) right=[expression "-" expression] position=3>,
237
- nil,
238
- nil,
239
- nil,
240
- nil,
241
- nil,
242
- #<Antelope::Generation::Recognizer::Rule id=80 left=expression(13:19) right=[expression "*" expression] position=3>,
243
- nil,
244
- nil,
245
- nil,
246
- nil,
247
- nil,
248
- #<Antelope::Generation::Recognizer::Rule id=86 left=expression(13:19) right=[expression "/" expression] position=3>,
249
- #<Antelope::Generation::Recognizer::Rule id=87 left=$start(0) right=[expression $] position=1>,
250
- #<Antelope::Generation::Recognizer::Rule id=88 left=expression(13:19) right=[expression "+" expression] position=1>,
251
- #<Antelope::Generation::Recognizer::Rule id=89 left=expression(13:19) right=[expression "-" expression] position=1>,
252
- #<Antelope::Generation::Recognizer::Rule id=90 left=expression(13:19) right=[expression "*" expression] position=1>,
253
- #<Antelope::Generation::Recognizer::Rule id=91 left=expression(13:19) right=[expression "/" expression] position=1>,
254
- #<Antelope::Generation::Recognizer::Rule id=92 left=expression(13:19) right=["(" expression ")"] position=3>,
255
- #<Antelope::Generation::Recognizer::Rule id=93 left=expression(13:19) right=["(" $error ")"] position=3>]
80
+ State 0:
81
+ expression: state (1)
82
+ NUMBER : state (2)
83
+ LPAREN : state (7)
84
+ State 1:
85
+ $ : state (9)
86
+ ADD : state (10)
87
+ SUBTRACT : state (11)
88
+ MULTIPLY : state (12)
89
+ DIVIDE : state (13)
90
+ State 2:
91
+ $ : reduce (1)
92
+ ADD : reduce (1)
93
+ SUBTRACT : reduce (1)
94
+ MULTIPLY : reduce (1)
95
+ DIVIDE : reduce (1)
96
+ RPAREN : reduce (1)
97
+ State 3:
98
+ ADD : state (10)
99
+ State 4:
100
+ SUBTRACT : state (11)
101
+ State 5:
102
+ MULTIPLY : state (12)
103
+ State 6:
104
+ DIVIDE : state (13)
105
+ State 7:
106
+ expression: state (14)
107
+ NUMBER : state (2)
108
+ LPAREN : state (7)
109
+ $error : state (15)
110
+ State 8:
111
+ $error : state (15)
112
+ State 9:
113
+ $ : accept (0)
114
+ State 10:
115
+ expression: state (16)
116
+ NUMBER : state (2)
117
+ LPAREN : state (7)
118
+ State 11:
119
+ expression: state (17)
120
+ NUMBER : state (2)
121
+ LPAREN : state (7)
122
+ State 12:
123
+ expression: state (18)
124
+ NUMBER : state (2)
125
+ LPAREN : state (7)
126
+ State 13:
127
+ expression: state (19)
128
+ NUMBER : state (2)
129
+ LPAREN : state (7)
130
+ State 14:
131
+ $ : state (9)
132
+ ADD : state (10)
133
+ SUBTRACT : state (11)
134
+ MULTIPLY : state (12)
135
+ DIVIDE : state (13)
136
+ RPAREN : state (20)
137
+ State 15:
138
+ RPAREN : state (21)
139
+ State 16:
140
+ $ : reduce (2)
141
+ ADD : reduce (2)
142
+ SUBTRACT : reduce (2)
143
+ MULTIPLY : state (12)
144
+ DIVIDE : state (13)
145
+ RPAREN : reduce (2)
146
+ State 17:
147
+ $ : reduce (3)
148
+ ADD : reduce (3)
149
+ SUBTRACT : reduce (3)
150
+ MULTIPLY : state (12)
151
+ DIVIDE : state (13)
152
+ RPAREN : reduce (3)
153
+ State 18:
154
+ $ : reduce (4)
155
+ ADD : reduce (4)
156
+ SUBTRACT : reduce (4)
157
+ MULTIPLY : reduce (4)
158
+ DIVIDE : reduce (4)
159
+ RPAREN : reduce (4)
160
+ State 19:
161
+ $ : reduce (5)
162
+ ADD : reduce (5)
163
+ SUBTRACT : reduce (5)
164
+ MULTIPLY : reduce (5)
165
+ DIVIDE : reduce (5)
166
+ RPAREN : reduce (5)
167
+ State 20:
168
+ $ : reduce (6)
169
+ ADD : reduce (6)
170
+ SUBTRACT : reduce (6)
171
+ MULTIPLY : reduce (6)
172
+ DIVIDE : reduce (6)
173
+ RPAREN : reduce (6)
174
+ State 21:
175
+ $ : reduce (7)
176
+ ADD : reduce (7)
177
+ SUBTRACT : reduce (7)
178
+ MULTIPLY : reduce (7)
179
+ DIVIDE : reduce (7)
180
+ RPAREN : reduce (7)
181
+
256
182
 
257
183
  State 0:
258
184
  rules:
259
185
  0/n0: $start(0) → • expression(0:1) $
260
186
  {}
261
- 1/n1: expression(13:19) → • NUMBER
187
+ 1/n1: expression(0:1) → • NUMBER
262
188
  {}
263
- 2/l2: expression(13:19) → • expression(0:1) "+" expression(10:16)
189
+ 2/l2: expression(0:1) → • expression(0:1) "+" expression(10:16)
264
190
  {}
265
- 3/l2: expression(13:19) → • expression(0:1) "-" expression(11:17)
191
+ 3/l2: expression(0:1) → • expression(0:1) "-" expression(11:17)
266
192
  {}
267
- 4/l3: expression(13:19) → • expression(0:1) "*" expression(12:18)
193
+ 4/l3: expression(0:1) → • expression(0:1) "*" expression(12:18)
268
194
  {}
269
- 5/l3: expression(13:19) → • expression(0:1) "/" expression(13:19)
195
+ 5/l3: expression(0:1) → • expression(0:1) "/" expression(13:19)
270
196
  {}
271
- 6/n4: expression(13:19) → • "(" expression(7:14) ")"
197
+ 6/n4: expression(0:1) → • "(" expression(7:14) ")"
272
198
  {}
273
- 7/n4: expression(13:19) → • "(" $error ")"
199
+ 7/n4: expression(0:1) → • "(" $error ")"
274
200
  {}
275
201
 
276
202
  transitions:
@@ -280,15 +206,15 @@ State 0:
280
206
 
281
207
  State 1:
282
208
  rules:
283
- 87/n0: $start(0) → expression • $
209
+ 87/n0: $start → expression • $
284
210
  {}
285
- 88/l2: expression(13:19) → expression • "+" expression
211
+ 88/l2: expression → expression • "+" expression
286
212
  {}
287
- 89/l2: expression(13:19) → expression • "-" expression
213
+ 89/l2: expression → expression • "-" expression
288
214
  {}
289
- 90/l3: expression(13:19) → expression • "*" expression
215
+ 90/l3: expression → expression • "*" expression
290
216
  {}
291
- 91/l3: expression(13:19) → expression • "/" expression
217
+ 91/l3: expression → expression • "/" expression
292
218
  {}
293
219
 
294
220
  transitions:
@@ -300,14 +226,14 @@ State 1:
300
226
 
301
227
  State 2:
302
228
  rules:
303
- 13/n1: expression(13:19) → NUMBER •
304
- {"+", "-", "*", "/", ")", $}
229
+ 13/n1: expression → NUMBER •
230
+ {$, "+", "-", "*", "/", ")"}
305
231
 
306
232
  transitions:
307
233
 
308
234
  State 3:
309
235
  rules:
310
- 88/l2: expression(13:19) → expression • "+" expression
236
+ 88/l2: expression → expression • "+" expression
311
237
  {}
312
238
 
313
239
  transitions:
@@ -315,7 +241,7 @@ State 3:
315
241
 
316
242
  State 4:
317
243
  rules:
318
- 89/l2: expression(13:19) → expression • "-" expression
244
+ 89/l2: expression → expression • "-" expression
319
245
  {}
320
246
 
321
247
  transitions:
@@ -323,7 +249,7 @@ State 4:
323
249
 
324
250
  State 5:
325
251
  rules:
326
- 90/l3: expression(13:19) → expression • "*" expression
252
+ 90/l3: expression → expression • "*" expression
327
253
  {}
328
254
 
329
255
  transitions:
@@ -331,7 +257,7 @@ State 5:
331
257
 
332
258
  State 6:
333
259
  rules:
334
- 91/l3: expression(13:19) → expression • "/" expression
260
+ 91/l3: expression → expression • "/" expression
335
261
  {}
336
262
 
337
263
  transitions:
@@ -339,23 +265,23 @@ State 6:
339
265
 
340
266
  State 7:
341
267
  rules:
342
- 18/n4: expression(13:19) → "(" • expression ")"
268
+ 18/n4: expression → "(" • expression ")"
343
269
  {}
344
- 19/n1: expression(13:19) → • NUMBER
270
+ 19/n1: expression(7:14) → • NUMBER
345
271
  {}
346
- 20/l2: expression(13:19) → • expression(7:14) "+" expression(10:16)
272
+ 20/l2: expression(7:14) → • expression(7:14) "+" expression(10:16)
347
273
  {}
348
- 21/l2: expression(13:19) → • expression(7:14) "-" expression(11:17)
274
+ 21/l2: expression(7:14) → • expression(7:14) "-" expression(11:17)
349
275
  {}
350
- 22/l3: expression(13:19) → • expression(7:14) "*" expression(12:18)
276
+ 22/l3: expression(7:14) → • expression(7:14) "*" expression(12:18)
351
277
  {}
352
- 23/l3: expression(13:19) → • expression(7:14) "/" expression(13:19)
278
+ 23/l3: expression(7:14) → • expression(7:14) "/" expression(13:19)
353
279
  {}
354
- 24/n4: expression(13:19) → • "(" expression(7:14) ")"
280
+ 24/n4: expression(7:14) → • "(" expression(7:14) ")"
355
281
  {}
356
- 25/n4: expression(13:19) → • "(" $error ")"
282
+ 25/n4: expression(7:14) → • "(" $error ")"
357
283
  {}
358
- 27/n4: expression(13:19) → "(" • $error ")"
284
+ 27/n4: expression → "(" • $error ")"
359
285
  {}
360
286
 
361
287
  transitions:
@@ -366,7 +292,7 @@ State 7:
366
292
 
367
293
  State 8:
368
294
  rules:
369
- 27/n4: expression(13:19) → "(" • $error ")"
295
+ 27/n4: expression → "(" • $error ")"
370
296
  {}
371
297
 
372
298
  transitions:
@@ -374,28 +300,28 @@ State 8:
374
300
 
375
301
  State 9:
376
302
  rules:
377
- 28/n0: $start(0) → expression $ •
303
+ 28/n0: $start → expression $ •
378
304
  {}
379
305
 
380
306
  transitions:
381
307
 
382
308
  State 10:
383
309
  rules:
384
- 29/l2: expression(13:19) → expression "+" • expression
310
+ 29/l2: expression → expression "+" • expression
385
311
  {}
386
- 30/n1: expression(13:19) → • NUMBER
312
+ 30/n1: expression(10:16) → • NUMBER
387
313
  {}
388
- 31/l2: expression(13:19) → • expression(10:16) "+" expression(10:16)
314
+ 31/l2: expression(10:16) → • expression(10:16) "+" expression(10:16)
389
315
  {}
390
- 32/l2: expression(13:19) → • expression(10:16) "-" expression(11:17)
316
+ 32/l2: expression(10:16) → • expression(10:16) "-" expression(11:17)
391
317
  {}
392
- 33/l3: expression(13:19) → • expression(10:16) "*" expression(12:18)
318
+ 33/l3: expression(10:16) → • expression(10:16) "*" expression(12:18)
393
319
  {}
394
- 34/l3: expression(13:19) → • expression(10:16) "/" expression(13:19)
320
+ 34/l3: expression(10:16) → • expression(10:16) "/" expression(13:19)
395
321
  {}
396
- 35/n4: expression(13:19) → • "(" expression(7:14) ")"
322
+ 35/n4: expression(10:16) → • "(" expression(7:14) ")"
397
323
  {}
398
- 36/n4: expression(13:19) → • "(" $error ")"
324
+ 36/n4: expression(10:16) → • "(" $error ")"
399
325
  {}
400
326
 
401
327
  transitions:
@@ -405,21 +331,21 @@ State 10:
405
331
 
406
332
  State 11:
407
333
  rules:
408
- 37/l2: expression(13:19) → expression "-" • expression
334
+ 37/l2: expression → expression "-" • expression
409
335
  {}
410
- 38/n1: expression(13:19) → • NUMBER
336
+ 38/n1: expression(11:17) → • NUMBER
411
337
  {}
412
- 39/l2: expression(13:19) → • expression(11:17) "+" expression(10:16)
338
+ 39/l2: expression(11:17) → • expression(11:17) "+" expression(10:16)
413
339
  {}
414
- 40/l2: expression(13:19) → • expression(11:17) "-" expression(11:17)
340
+ 40/l2: expression(11:17) → • expression(11:17) "-" expression(11:17)
415
341
  {}
416
- 41/l3: expression(13:19) → • expression(11:17) "*" expression(12:18)
342
+ 41/l3: expression(11:17) → • expression(11:17) "*" expression(12:18)
417
343
  {}
418
- 42/l3: expression(13:19) → • expression(11:17) "/" expression(13:19)
344
+ 42/l3: expression(11:17) → • expression(11:17) "/" expression(13:19)
419
345
  {}
420
- 43/n4: expression(13:19) → • "(" expression(7:14) ")"
346
+ 43/n4: expression(11:17) → • "(" expression(7:14) ")"
421
347
  {}
422
- 44/n4: expression(13:19) → • "(" $error ")"
348
+ 44/n4: expression(11:17) → • "(" $error ")"
423
349
  {}
424
350
 
425
351
  transitions:
@@ -429,21 +355,21 @@ State 11:
429
355
 
430
356
  State 12:
431
357
  rules:
432
- 45/l3: expression(13:19) → expression "*" • expression
358
+ 45/l3: expression → expression "*" • expression
433
359
  {}
434
- 46/n1: expression(13:19) → • NUMBER
360
+ 46/n1: expression(12:18) → • NUMBER
435
361
  {}
436
- 47/l2: expression(13:19) → • expression(12:18) "+" expression(10:16)
362
+ 47/l2: expression(12:18) → • expression(12:18) "+" expression(10:16)
437
363
  {}
438
- 48/l2: expression(13:19) → • expression(12:18) "-" expression(11:17)
364
+ 48/l2: expression(12:18) → • expression(12:18) "-" expression(11:17)
439
365
  {}
440
- 49/l3: expression(13:19) → • expression(12:18) "*" expression(12:18)
366
+ 49/l3: expression(12:18) → • expression(12:18) "*" expression(12:18)
441
367
  {}
442
- 50/l3: expression(13:19) → • expression(12:18) "/" expression(13:19)
368
+ 50/l3: expression(12:18) → • expression(12:18) "/" expression(13:19)
443
369
  {}
444
- 51/n4: expression(13:19) → • "(" expression(7:14) ")"
370
+ 51/n4: expression(12:18) → • "(" expression(7:14) ")"
445
371
  {}
446
- 52/n4: expression(13:19) → • "(" $error ")"
372
+ 52/n4: expression(12:18) → • "(" $error ")"
447
373
  {}
448
374
 
449
375
  transitions:
@@ -453,7 +379,7 @@ State 12:
453
379
 
454
380
  State 13:
455
381
  rules:
456
- 53/l3: expression(13:19) → expression "/" • expression
382
+ 53/l3: expression → expression "/" • expression
457
383
  {}
458
384
  54/n1: expression(13:19) → • NUMBER
459
385
  {}
@@ -477,17 +403,17 @@ State 13:
477
403
 
478
404
  State 14:
479
405
  rules:
480
- 61/n4: expression(13:19) → "(" expression • ")"
406
+ 61/n4: expression → "(" expression • ")"
481
407
  {}
482
- 87/n0: $start(0) → expression • $
408
+ 87/n0: $start → expression • $
483
409
  {}
484
- 88/l2: expression(13:19) → expression • "+" expression
410
+ 88/l2: expression → expression • "+" expression
485
411
  {}
486
- 89/l2: expression(13:19) → expression • "-" expression
412
+ 89/l2: expression → expression • "-" expression
487
413
  {}
488
- 90/l3: expression(13:19) → expression • "*" expression
414
+ 90/l3: expression → expression • "*" expression
489
415
  {}
490
- 91/l3: expression(13:19) → expression • "/" expression
416
+ 91/l3: expression → expression • "/" expression
491
417
  {}
492
418
 
493
419
  transitions:
@@ -500,7 +426,7 @@ State 14:
500
426
 
501
427
  State 15:
502
428
  rules:
503
- 67/n4: expression(13:19) → "(" $error • ")"
429
+ 67/n4: expression → "(" $error • ")"
504
430
  {}
505
431
 
506
432
  transitions:
@@ -508,17 +434,17 @@ State 15:
508
434
 
509
435
  State 16:
510
436
  rules:
511
- 68/l2: expression(13:19) → expression "+" expression •
512
- {"+", "-", "*", "/", ")", $}
513
- 87/n0: $start(0) → expression • $
437
+ 68/l2: expression → expression "+" expression •
438
+ {$, "+", "-", "*", "/", ")"}
439
+ 87/n0: $start → expression • $
514
440
  {}
515
- 88/l2: expression(13:19) → expression • "+" expression
441
+ 88/l2: expression → expression • "+" expression
516
442
  {}
517
- 89/l2: expression(13:19) → expression • "-" expression
443
+ 89/l2: expression → expression • "-" expression
518
444
  {}
519
- 90/l3: expression(13:19) → expression • "*" expression
445
+ 90/l3: expression → expression • "*" expression
520
446
  {}
521
- 91/l3: expression(13:19) → expression • "/" expression
447
+ 91/l3: expression → expression • "/" expression
522
448
  {}
523
449
 
524
450
  transitions:
@@ -530,17 +456,17 @@ State 16:
530
456
 
531
457
  State 17:
532
458
  rules:
533
- 74/l2: expression(13:19) → expression "-" expression •
534
- {"+", "-", "*", "/", ")", $}
535
- 87/n0: $start(0) → expression • $
459
+ 74/l2: expression → expression "-" expression •
460
+ {$, "+", "-", "*", "/", ")"}
461
+ 87/n0: $start → expression • $
536
462
  {}
537
- 88/l2: expression(13:19) → expression • "+" expression
463
+ 88/l2: expression → expression • "+" expression
538
464
  {}
539
- 89/l2: expression(13:19) → expression • "-" expression
465
+ 89/l2: expression → expression • "-" expression
540
466
  {}
541
- 90/l3: expression(13:19) → expression • "*" expression
467
+ 90/l3: expression → expression • "*" expression
542
468
  {}
543
- 91/l3: expression(13:19) → expression • "/" expression
469
+ 91/l3: expression → expression • "/" expression
544
470
  {}
545
471
 
546
472
  transitions:
@@ -552,17 +478,17 @@ State 17:
552
478
 
553
479
  State 18:
554
480
  rules:
555
- 80/l3: expression(13:19) → expression "*" expression •
556
- {"+", "-", "*", "/", ")", $}
557
- 87/n0: $start(0) → expression • $
481
+ 80/l3: expression → expression "*" expression •
482
+ {$, "+", "-", "*", "/", ")"}
483
+ 87/n0: $start → expression • $
558
484
  {}
559
- 88/l2: expression(13:19) → expression • "+" expression
485
+ 88/l2: expression → expression • "+" expression
560
486
  {}
561
- 89/l2: expression(13:19) → expression • "-" expression
487
+ 89/l2: expression → expression • "-" expression
562
488
  {}
563
- 90/l3: expression(13:19) → expression • "*" expression
489
+ 90/l3: expression → expression • "*" expression
564
490
  {}
565
- 91/l3: expression(13:19) → expression • "/" expression
491
+ 91/l3: expression → expression • "/" expression
566
492
  {}
567
493
 
568
494
  transitions:
@@ -574,17 +500,17 @@ State 18:
574
500
 
575
501
  State 19:
576
502
  rules:
577
- 86/l3: expression(13:19) → expression "/" expression •
578
- {"+", "-", "*", "/", ")", $}
579
- 87/n0: $start(0) → expression • $
503
+ 86/l3: expression → expression "/" expression •
504
+ {$, "+", "-", "*", "/", ")"}
505
+ 87/n0: $start → expression • $
580
506
  {}
581
- 88/l2: expression(13:19) → expression • "+" expression
507
+ 88/l2: expression → expression • "+" expression
582
508
  {}
583
- 89/l2: expression(13:19) → expression • "-" expression
509
+ 89/l2: expression → expression • "-" expression
584
510
  {}
585
- 90/l3: expression(13:19) → expression • "*" expression
511
+ 90/l3: expression → expression • "*" expression
586
512
  {}
587
- 91/l3: expression(13:19) → expression • "/" expression
513
+ 91/l3: expression → expression • "/" expression
588
514
  {}
589
515
 
590
516
  transitions:
@@ -596,15 +522,15 @@ State 19:
596
522
 
597
523
  State 20:
598
524
  rules:
599
- 92/n4: expression(13:19) → "(" expression ")" •
600
- {"+", "-", "*", "/", ")", $}
525
+ 92/n4: expression → "(" expression ")" •
526
+ {$, "+", "-", "*", "/", ")"}
601
527
 
602
528
  transitions:
603
529
 
604
530
  State 21:
605
531
  rules:
606
- 93/n4: expression(13:19) → "(" $error ")" •
607
- {"+", "-", "*", "/", ")", $}
532
+ 93/n4: expression → "(" $error ")" •
533
+ {$, "+", "-", "*", "/", ")"}
608
534
 
609
535
  transitions:
610
536