antelope 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +25 -23
  3. data/.rspec +3 -3
  4. data/.travis.yml +10 -9
  5. data/.yardopts +7 -7
  6. data/CONTRIBUTING.md +38 -38
  7. data/GENERATORS.md +124 -124
  8. data/Gemfile +7 -7
  9. data/LICENSE.txt +22 -22
  10. data/README.md +104 -104
  11. data/Rakefile +2 -2
  12. data/TODO.md +58 -58
  13. data/antelope.gemspec +28 -28
  14. data/bin/antelope +7 -7
  15. data/examples/deterministic.ace +35 -35
  16. data/examples/example.ace +51 -50
  17. data/examples/example.err +192 -0
  18. data/examples/{example.output → example.inf} +384 -385
  19. data/examples/liquidscript.ace +233 -162
  20. data/examples/simple.ace +22 -22
  21. data/lib/antelope/ace/compiler.rb +334 -334
  22. data/lib/antelope/ace/errors.rb +48 -48
  23. data/lib/antelope/ace/grammar/generation.rb +80 -80
  24. data/lib/antelope/ace/grammar/loading.rb +53 -53
  25. data/lib/antelope/ace/grammar/precedences.rb +68 -65
  26. data/lib/antelope/ace/grammar/productions.rb +156 -150
  27. data/lib/antelope/ace/grammar/symbols.rb +66 -66
  28. data/lib/antelope/ace/grammar.rb +69 -69
  29. data/lib/antelope/ace/precedence.rb +61 -61
  30. data/lib/antelope/ace/production.rb +57 -57
  31. data/lib/antelope/ace/scanner/argument.rb +57 -57
  32. data/lib/antelope/ace/scanner/first.rb +89 -89
  33. data/lib/antelope/ace/scanner/second.rb +177 -177
  34. data/lib/antelope/ace/scanner/third.rb +27 -27
  35. data/lib/antelope/ace/scanner.rb +134 -134
  36. data/lib/antelope/ace/token/epsilon.rb +24 -24
  37. data/lib/antelope/ace/token/error.rb +26 -26
  38. data/lib/antelope/ace/token/nonterminal.rb +17 -17
  39. data/lib/antelope/ace/token/terminal.rb +17 -17
  40. data/lib/antelope/ace/token.rb +238 -238
  41. data/lib/antelope/ace.rb +53 -53
  42. data/lib/antelope/cli.rb +55 -55
  43. data/lib/antelope/errors.rb +8 -8
  44. data/lib/antelope/generation/constructor/first.rb +88 -88
  45. data/lib/antelope/generation/constructor/follow.rb +103 -103
  46. data/lib/antelope/generation/constructor/nullable.rb +64 -64
  47. data/lib/antelope/generation/constructor.rb +126 -126
  48. data/lib/antelope/generation/errors.rb +17 -17
  49. data/lib/antelope/generation/null.rb +13 -13
  50. data/lib/antelope/generation/recognizer/rule.rb +216 -216
  51. data/lib/antelope/generation/recognizer/state.rb +130 -130
  52. data/lib/antelope/generation/recognizer.rb +180 -180
  53. data/lib/antelope/generation/tableizer.rb +175 -154
  54. data/lib/antelope/generation.rb +15 -15
  55. data/lib/antelope/generator/base.rb +264 -264
  56. data/lib/antelope/generator/c.rb +11 -11
  57. data/lib/antelope/generator/c_header.rb +105 -105
  58. data/lib/antelope/generator/c_source.rb +39 -39
  59. data/lib/antelope/generator/error.rb +34 -0
  60. data/lib/antelope/generator/group.rb +57 -57
  61. data/lib/antelope/generator/html.rb +51 -0
  62. data/lib/antelope/generator/info.rb +47 -0
  63. data/lib/antelope/generator/null.rb +18 -18
  64. data/lib/antelope/generator/output.rb +17 -49
  65. data/lib/antelope/generator/ruby.rb +79 -79
  66. data/lib/antelope/generator/templates/c_header.ant +36 -36
  67. data/lib/antelope/generator/templates/c_source.ant +202 -202
  68. data/lib/antelope/generator/templates/error.ant +33 -0
  69. data/lib/antelope/generator/templates/html/antelope.css +1 -0
  70. data/lib/antelope/generator/templates/html/antelope.html +1 -0
  71. data/lib/antelope/generator/templates/html/antelope.js +1 -0
  72. data/lib/antelope/generator/templates/html/css.ant +53 -0
  73. data/lib/antelope/generator/templates/html/html.ant +82 -0
  74. data/lib/antelope/generator/templates/html/js.ant +9 -0
  75. data/lib/antelope/generator/templates/info.ant +53 -0
  76. data/lib/antelope/generator/templates/ruby.ant +178 -146
  77. data/lib/antelope/generator.rb +66 -63
  78. data/lib/antelope/template/compiler.rb +78 -78
  79. data/lib/antelope/template/errors.rb +9 -9
  80. data/lib/antelope/template/scanner.rb +109 -109
  81. data/lib/antelope/template.rb +65 -60
  82. data/lib/antelope/version.rb +6 -6
  83. data/lib/antelope.rb +13 -13
  84. data/optimizations.txt +42 -0
  85. data/spec/antelope/ace/compiler_spec.rb +60 -60
  86. data/spec/antelope/ace/scanner_spec.rb +27 -27
  87. data/spec/antelope/constructor_spec.rb +133 -136
  88. data/spec/antelope/template_spec.rb +50 -49
  89. data/spec/fixtures/simple.ace +22 -22
  90. data/spec/spec_helper.rb +39 -39
  91. data/spec/support/benchmark_helper.rb +5 -5
  92. data/spec/support/grammar_helper.rb +15 -15
  93. data/subl/Ace (Ruby).JSON-tmLanguage +94 -94
  94. data/subl/Ace (Ruby).tmLanguage +153 -153
  95. metadata +17 -6
  96. data/lib/antelope/generator/templates/output.ant +0 -68
@@ -0,0 +1,192 @@
1
+ Productions:
2
+ 0 $start → expression $end
3
+ 1 expression → NUMBER { |a| a[1] }
4
+ 2 expression → expression "^" expression { |a, _, b| a** b }
5
+ 3 expression → expression "+" expression { |a, _, b| a + b }
6
+ 4 expression → expression "-" expression { |a, _, b| a - b }
7
+ 5 expression → expression "*" expression { |a, _, b| a * b }
8
+ 6 expression → expression "/" expression { |a, _, b| a / b }
9
+ 7 expression → "(" expression ")" { |_, a, _| a }
10
+ 8 expression → "(" $error ")" { |_, e, _| e[1] }
11
+
12
+ Error:
13
+ Conflicts in State 12:
14
+ On EXPONENTIATE (resolved):
15
+ state 5/reduce 2 (r4 vs r4, -1)
16
+ Rules:
17
+ 79/r4: expression → expression "^" expression •
18
+ {$end, "^", "+", "-", "*", "/", ")"}
19
+ Transitions:
20
+ 80/r4: expression → expression • "^" expression
21
+ On ADD (resolved):
22
+ state 6/reduce 2 (r4 vs l2, 1)
23
+ Rules:
24
+ 79/r4: expression → expression "^" expression •
25
+ {$end, "^", "+", "-", "*", "/", ")"}
26
+ Transitions:
27
+ 81/l2: expression → expression • "+" expression
28
+ On SUBTRACT (resolved):
29
+ state 7/reduce 2 (r4 vs l2, 1)
30
+ Rules:
31
+ 79/r4: expression → expression "^" expression •
32
+ {$end, "^", "+", "-", "*", "/", ")"}
33
+ Transitions:
34
+ 82/l2: expression → expression • "-" expression
35
+ On MULTIPLY (resolved):
36
+ state 8/reduce 2 (r4 vs l3, 1)
37
+ Rules:
38
+ 79/r4: expression → expression "^" expression •
39
+ {$end, "^", "+", "-", "*", "/", ")"}
40
+ Transitions:
41
+ 83/l3: expression → expression • "*" expression
42
+ On DIVIDE (resolved):
43
+ state 9/reduce 2 (r4 vs l3, 1)
44
+ Rules:
45
+ 79/r4: expression → expression "^" expression •
46
+ {$end, "^", "+", "-", "*", "/", ")"}
47
+ Transitions:
48
+ 84/l3: expression → expression • "/" expression
49
+ Conflicts in State 13:
50
+ On EXPONENTIATE (resolved):
51
+ state 5/reduce 3 (l2 vs r4, -1)
52
+ Rules:
53
+ 85/l2: expression → expression "+" expression •
54
+ {$end, "^", "+", "-", "*", "/", ")"}
55
+ Transitions:
56
+ 86/r4: expression → expression • "^" expression
57
+ On ADD (resolved):
58
+ state 6/reduce 3 (l2 vs l2, 1)
59
+ Rules:
60
+ 85/l2: expression → expression "+" expression •
61
+ {$end, "^", "+", "-", "*", "/", ")"}
62
+ Transitions:
63
+ 87/l2: expression → expression • "+" expression
64
+ On SUBTRACT (resolved):
65
+ state 7/reduce 3 (l2 vs l2, 1)
66
+ Rules:
67
+ 85/l2: expression → expression "+" expression •
68
+ {$end, "^", "+", "-", "*", "/", ")"}
69
+ Transitions:
70
+ 88/l2: expression → expression • "-" expression
71
+ On MULTIPLY (resolved):
72
+ state 8/reduce 3 (l2 vs l3, -1)
73
+ Rules:
74
+ 85/l2: expression → expression "+" expression •
75
+ {$end, "^", "+", "-", "*", "/", ")"}
76
+ Transitions:
77
+ 89/l3: expression → expression • "*" expression
78
+ On DIVIDE (resolved):
79
+ state 9/reduce 3 (l2 vs l3, -1)
80
+ Rules:
81
+ 85/l2: expression → expression "+" expression •
82
+ {$end, "^", "+", "-", "*", "/", ")"}
83
+ Transitions:
84
+ 90/l3: expression → expression • "/" expression
85
+ Conflicts in State 14:
86
+ On EXPONENTIATE (resolved):
87
+ state 5/reduce 4 (l2 vs r4, -1)
88
+ Rules:
89
+ 91/l2: expression → expression "-" expression •
90
+ {$end, "^", "+", "-", "*", "/", ")"}
91
+ Transitions:
92
+ 92/r4: expression → expression • "^" expression
93
+ On ADD (resolved):
94
+ state 6/reduce 4 (l2 vs l2, 1)
95
+ Rules:
96
+ 91/l2: expression → expression "-" expression •
97
+ {$end, "^", "+", "-", "*", "/", ")"}
98
+ Transitions:
99
+ 93/l2: expression → expression • "+" expression
100
+ On SUBTRACT (resolved):
101
+ state 7/reduce 4 (l2 vs l2, 1)
102
+ Rules:
103
+ 91/l2: expression → expression "-" expression •
104
+ {$end, "^", "+", "-", "*", "/", ")"}
105
+ Transitions:
106
+ 94/l2: expression → expression • "-" expression
107
+ On MULTIPLY (resolved):
108
+ state 8/reduce 4 (l2 vs l3, -1)
109
+ Rules:
110
+ 91/l2: expression → expression "-" expression •
111
+ {$end, "^", "+", "-", "*", "/", ")"}
112
+ Transitions:
113
+ 95/l3: expression → expression • "*" expression
114
+ On DIVIDE (resolved):
115
+ state 9/reduce 4 (l2 vs l3, -1)
116
+ Rules:
117
+ 91/l2: expression → expression "-" expression •
118
+ {$end, "^", "+", "-", "*", "/", ")"}
119
+ Transitions:
120
+ 96/l3: expression → expression • "/" expression
121
+ Conflicts in State 15:
122
+ On EXPONENTIATE (resolved):
123
+ state 5/reduce 5 (l3 vs r4, -1)
124
+ Rules:
125
+ 97/l3: expression → expression "*" expression •
126
+ {$end, "^", "+", "-", "*", "/", ")"}
127
+ Transitions:
128
+ 98/r4: expression → expression • "^" expression
129
+ On ADD (resolved):
130
+ state 6/reduce 5 (l3 vs l2, 1)
131
+ Rules:
132
+ 97/l3: expression → expression "*" expression •
133
+ {$end, "^", "+", "-", "*", "/", ")"}
134
+ Transitions:
135
+ 99/l2: expression → expression • "+" expression
136
+ On SUBTRACT (resolved):
137
+ state 7/reduce 5 (l3 vs l2, 1)
138
+ Rules:
139
+ 97/l3: expression → expression "*" expression •
140
+ {$end, "^", "+", "-", "*", "/", ")"}
141
+ Transitions:
142
+ 100/l2: expression → expression • "-" expression
143
+ On MULTIPLY (resolved):
144
+ state 8/reduce 5 (l3 vs l3, 1)
145
+ Rules:
146
+ 97/l3: expression → expression "*" expression •
147
+ {$end, "^", "+", "-", "*", "/", ")"}
148
+ Transitions:
149
+ 101/l3: expression → expression • "*" expression
150
+ On DIVIDE (resolved):
151
+ state 9/reduce 5 (l3 vs l3, 1)
152
+ Rules:
153
+ 97/l3: expression → expression "*" expression •
154
+ {$end, "^", "+", "-", "*", "/", ")"}
155
+ Transitions:
156
+ 102/l3: expression → expression • "/" expression
157
+ Conflicts in State 16:
158
+ On EXPONENTIATE (resolved):
159
+ state 5/reduce 6 (l3 vs r4, -1)
160
+ Rules:
161
+ 103/l3: expression → expression "/" expression •
162
+ {$end, "^", "+", "-", "*", "/", ")"}
163
+ Transitions:
164
+ 104/r4: expression → expression • "^" expression
165
+ On ADD (resolved):
166
+ state 6/reduce 6 (l3 vs l2, 1)
167
+ Rules:
168
+ 103/l3: expression → expression "/" expression •
169
+ {$end, "^", "+", "-", "*", "/", ")"}
170
+ Transitions:
171
+ 105/l2: expression → expression • "+" expression
172
+ On SUBTRACT (resolved):
173
+ state 7/reduce 6 (l3 vs l2, 1)
174
+ Rules:
175
+ 103/l3: expression → expression "/" expression •
176
+ {$end, "^", "+", "-", "*", "/", ")"}
177
+ Transitions:
178
+ 106/l2: expression → expression • "-" expression
179
+ On MULTIPLY (resolved):
180
+ state 8/reduce 6 (l3 vs l3, 1)
181
+ Rules:
182
+ 103/l3: expression → expression "/" expression •
183
+ {$end, "^", "+", "-", "*", "/", ")"}
184
+ Transitions:
185
+ 107/l3: expression → expression • "*" expression
186
+ On DIVIDE (resolved):
187
+ state 9/reduce 6 (l3 vs l3, 1)
188
+ Rules:
189
+ 103/l3: expression → expression "/" expression •
190
+ {$end, "^", "+", "-", "*", "/", ")"}
191
+ Transitions:
192
+ 108/l3: expression → expression • "/" expression