antelope 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +7 -0
  3. data/examples/deterministic.output +53 -139
  4. data/examples/example.output +159 -347
  5. data/examples/simple.output +50 -124
  6. data/lib/antelope/ace/compiler.rb +10 -1
  7. data/lib/antelope/ace/errors.rb +8 -0
  8. data/lib/antelope/ace/grammar/generation.rb +6 -1
  9. data/lib/antelope/ace/grammar/loading.rb +2 -0
  10. data/lib/antelope/ace/grammar/precedences.rb +3 -1
  11. data/lib/antelope/ace/grammar/production.rb +2 -0
  12. data/lib/antelope/ace/grammar/productions.rb +2 -0
  13. data/lib/antelope/ace/grammar/terminals.rb +2 -0
  14. data/lib/antelope/ace/grammar.rb +2 -0
  15. data/lib/antelope/ace/precedence.rb +2 -0
  16. data/lib/antelope/ace/scanner/first.rb +2 -0
  17. data/lib/antelope/ace/scanner/second.rb +3 -1
  18. data/lib/antelope/ace/scanner/third.rb +2 -0
  19. data/lib/antelope/ace/scanner.rb +2 -0
  20. data/lib/antelope/ace/token/epsilon.rb +4 -2
  21. data/lib/antelope/ace/token/error.rb +2 -0
  22. data/lib/antelope/ace/token/nonterminal.rb +2 -0
  23. data/lib/antelope/ace/token/terminal.rb +2 -0
  24. data/lib/antelope/ace/token.rb +2 -0
  25. data/lib/antelope/ace.rb +2 -0
  26. data/lib/antelope/cli.rb +2 -0
  27. data/lib/antelope/errors.rb +2 -0
  28. data/lib/antelope/generation/constructor/first.rb +2 -0
  29. data/lib/antelope/generation/constructor/follow.rb +5 -0
  30. data/lib/antelope/generation/constructor/nullable.rb +2 -0
  31. data/lib/antelope/generation/constructor.rb +2 -0
  32. data/lib/antelope/generation/errors.rb +2 -0
  33. data/lib/antelope/generation/recognizer/rule.rb +9 -0
  34. data/lib/antelope/generation/recognizer/state.rb +2 -0
  35. data/lib/antelope/generation/recognizer.rb +7 -2
  36. data/lib/antelope/generation/tableizer.rb +3 -2
  37. data/lib/antelope/generation.rb +2 -0
  38. data/lib/antelope/generator/output.rb +2 -0
  39. data/lib/antelope/generator/ruby.rb +2 -0
  40. data/lib/antelope/generator/templates/output.erb +21 -25
  41. data/lib/antelope/generator/templates/ruby.erb +1 -1
  42. data/lib/antelope/generator.rb +2 -0
  43. data/lib/antelope/version.rb +3 -1
  44. data/lib/antelope.rb +2 -0
  45. data/spec/antelope/ace/compiler_spec.rb +11 -1
  46. data/spec/antelope/constructor_spec.rb +127 -0
  47. data/spec/fixtures/simple.ace +22 -0
  48. data/spec/spec_helper.rb +1 -0
  49. data/spec/support/grammar_helper.rb +15 -0
  50. metadata +9 -4
  51. data/spec/antelope/automaton_spec.rb +0 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e869096803def22c3c51670d07b69ca500b62818
4
- data.tar.gz: aa9bc4c8ec37f35ce319ea9581563a1a9573f067
3
+ metadata.gz: 71da8ce4c0f8cceea26c60114fe61a68566c51d3
4
+ data.tar.gz: 1d8b211f3289c0b61682c940a6796cd8f2ec9c5b
5
5
  SHA512:
6
- metadata.gz: e04d7fc30bb8ab39b793ab2336f77083a88082fc13274d3a93d3d6f5125580c4e2a892142190722e2e76ce9ceb0c5c40d1fbc50bca55c99cfefd569b0f3223c7
7
- data.tar.gz: 87d2c712bf3158daeb97abeb40d4ce4afb0e3684f42e87aec11236826437dee1580c23444bcb7a05fda28fcfcce3c23ede0cc4d057dc1f5483c8d594dcbbc49c
6
+ metadata.gz: 96343f18ac058863634f090b83f2a9055ae7938197a680adf185e59aa21b68e9bd27597aae7e9ef5b2ef7beacc0b45674ad8ccdcd016ec3a858f2f25bf0b8b73
7
+ data.tar.gz: 199832b949ccd099e082f99c8bf60d2eb83bf268b7306dbcc8c232a3910ad75f131ddf385b91bfbe38da85b946726da0edc616533296f6cf6e15d2e8e1ec57b9
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
4
+ - 2.0.0
5
+ - 1.9.3
6
+ - jruby-19mode
7
+ script: bundle exec rspec -f d spec
@@ -6,32 +6,6 @@ Productions:
6
6
  t → "(" e ")"
7
7
  $start → s $
8
8
 
9
- Productions, Again:
10
- 0/n0: $start(0) → s(0:1) $
11
- 1/n1: s(0:1) → e(0:2)
12
- 2/n1: e(0:2) → t(0:3) ";"
13
- 3/n1: e(0:2) → t(0:3) "+" e(9:11)
14
- 4/n1: t(0:3) → NUMBER
15
- 5/n1: t(0:3) → "(" e(6:10) ")"
16
- 13/n1: e(6:10) → t(6:3) ";"
17
- 14/n1: e(6:10) → t(6:3) "+" e(9:11)
18
- 15/n1: t(6:3) → NUMBER
19
- 16/n1: t(6:3) → "(" e(6:10) ")"
20
- 20/n1: e(9:11) → t(9:3) ";"
21
- 21/n1: e(9:11) → t(9:3) "+" e(9:11)
22
- 22/n1: t(9:3) → NUMBER
23
- 23/n1: t(9:3) → "(" e(6:10) ")"
24
-
25
- FOLLOW:
26
- $start(0): {}
27
- s(0:1): {$}
28
- e(0:2): {$}
29
- t(0:3): {";", "+"}
30
- e(6:10): {")"}
31
- t(6:3): {";", "+"}
32
- e(9:11): {$, ")"}
33
- t(9:3): {";", "+"}
34
-
35
9
  Precedence:
36
10
  --- highest
37
11
  nonassoc 1:
@@ -40,52 +14,7 @@ Precedence:
40
14
  {$}
41
15
  --- lowest
42
16
 
43
- Table:
44
17
  State 0:
45
- s : state (1)
46
- e : state (2)
47
- t : state (3)
48
- NUMBER : state (5)
49
- LPAREN : state (6)
50
- State 1:
51
- $ : state (7)
52
- State 2:
53
- $ : reduce (1)
54
- State 3:
55
- SEMICOLON: state (8)
56
- ADD : state (9)
57
- State 4:
58
- ADD : state (9)
59
- State 5:
60
- SEMICOLON: reduce (4)
61
- ADD : reduce (4)
62
- State 6:
63
- e : state (10)
64
- t : state (3)
65
- NUMBER : state (5)
66
- LPAREN : state (6)
67
- State 7:
68
- $ : accept (0)
69
- State 8:
70
- $ : reduce (2)
71
- RPAREN : reduce (2)
72
- State 9:
73
- e : state (11)
74
- t : state (3)
75
- NUMBER : state (5)
76
- LPAREN : state (6)
77
- State 10:
78
- RPAREN : state (12)
79
- State 11:
80
- $ : reduce (3)
81
- RPAREN : reduce (3)
82
- State 12:
83
- SEMICOLON: reduce (5)
84
- ADD : reduce (5)
85
-
86
-
87
- State 0:
88
- rules:
89
18
  0/n0: $start(0) → • s(0:1) $
90
19
  {}
91
20
  1/n1: s(0:1) → • e(0:2)
@@ -98,57 +27,48 @@ State 0:
98
27
  {}
99
28
  5/n1: t(0:3) → • "(" e(6:10) ")"
100
29
  {}
30
+ transitions:
31
+ s: State 1
32
+ e: State 2
33
+ t: State 3
34
+ NUMBER: State 5
35
+ LPAREN: State 6
101
36
 
102
- transitions:
103
- s : State 1
104
- e : State 2
105
- t : State 3
106
- NUMBER: State 5
107
- LPAREN: State 6
108
-
109
- State 1:
110
- rules:
37
+ State 1:
111
38
  6/n0: $start → s • $
112
39
  {}
40
+ transitions:
41
+ $: State 7
113
42
 
114
- transitions:
115
- $: State 7
116
-
117
- State 2:
118
- rules:
43
+ State 2:
119
44
  7/n1: s → e •
120
45
  {$}
46
+ reductions:
47
+ $: Rule 1
121
48
 
122
- transitions:
123
-
124
- State 3:
125
- rules:
49
+ State 3:
126
50
  8/n1: e → t • ";"
127
51
  {}
128
52
  10/n1: e → t • "+" e
129
53
  {}
54
+ transitions:
55
+ SEMICOLON: State 8
56
+ ADD: State 9
130
57
 
131
- transitions:
132
- SEMICOLON: State 8
133
- ADD : State 9
134
-
135
- State 4:
136
- rules:
58
+ State 4:
137
59
  10/n1: e → t • "+" e
138
60
  {}
61
+ transitions:
62
+ ADD: State 9
139
63
 
140
- transitions:
141
- ADD: State 9
142
-
143
- State 5:
144
- rules:
64
+ State 5:
145
65
  11/n1: t → NUMBER •
146
66
  {";", "+"}
67
+ reductions:
68
+ SEMICOLON: Rule 4
69
+ ADD: Rule 4
147
70
 
148
- transitions:
149
-
150
- State 6:
151
- rules:
71
+ State 6:
152
72
  12/n1: t → "(" • e ")"
153
73
  {}
154
74
  13/n1: e(6:10) → • t(6:3) ";"
@@ -159,29 +79,26 @@ State 6:
159
79
  {}
160
80
  16/n1: t(6:3) → • "(" e(6:10) ")"
161
81
  {}
82
+ transitions:
83
+ e: State 10
84
+ t: State 3
85
+ NUMBER: State 5
86
+ LPAREN: State 6
162
87
 
163
- transitions:
164
- e : State 10
165
- t : State 3
166
- NUMBER: State 5
167
- LPAREN: State 6
168
-
169
- State 7:
170
- rules:
88
+ State 7:
171
89
  17/n0: $start → s $ •
172
90
  {}
91
+ accepting:
92
+ $: Rule 0
173
93
 
174
- transitions:
175
-
176
- State 8:
177
- rules:
94
+ State 8:
178
95
  18/n1: e → t ";" •
179
96
  {$, ")"}
97
+ reductions:
98
+ $: Rule 2
99
+ RPAREN: Rule 2
180
100
 
181
- transitions:
182
-
183
- State 9:
184
- rules:
101
+ State 9:
185
102
  19/n1: e → t "+" • e
186
103
  {}
187
104
  20/n1: e(9:11) → • t(9:3) ";"
@@ -192,32 +109,29 @@ State 9:
192
109
  {}
193
110
  23/n1: t(9:3) → • "(" e(6:10) ")"
194
111
  {}
112
+ transitions:
113
+ e: State 11
114
+ t: State 3
115
+ NUMBER: State 5
116
+ LPAREN: State 6
195
117
 
196
- transitions:
197
- e : State 11
198
- t : State 3
199
- NUMBER: State 5
200
- LPAREN: State 6
201
-
202
- State 10:
203
- rules:
118
+ State 10:
204
119
  24/n1: t → "(" e • ")"
205
120
  {}
121
+ transitions:
122
+ RPAREN: State 12
206
123
 
207
- transitions:
208
- RPAREN: State 12
209
-
210
- State 11:
211
- rules:
124
+ State 11:
212
125
  25/n1: e → t "+" e •
213
126
  {$, ")"}
127
+ reductions:
128
+ $: Rule 3
129
+ RPAREN: Rule 3
214
130
 
215
- transitions:
216
-
217
- State 12:
218
- rules:
131
+ State 12:
219
132
  26/n1: t → "(" e ")" •
220
133
  {";", "+"}
221
-
222
- transitions:
134
+ reductions:
135
+ SEMICOLON: Rule 5
136
+ ADD: Rule 5
223
137