antelope 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/antelope.gemspec +0 -2
- data/bin/antelope +3 -20
- data/examples/deterministic.output +97 -103
- data/examples/example.ace +0 -1
- data/examples/example.output +259 -333
- data/examples/simple.output +85 -87
- data/lib/antelope/ace/compiler.rb +14 -16
- data/lib/antelope/ace/errors.rb +9 -3
- data/lib/antelope/ace/grammar/generation.rb +38 -7
- data/lib/antelope/ace/grammar/precedences.rb +59 -0
- data/lib/antelope/ace/grammar/production.rb +24 -25
- data/lib/antelope/ace/grammar/productions.rb +8 -8
- data/lib/antelope/ace/grammar.rb +3 -3
- data/lib/antelope/ace/{presidence.rb → precedence.rb} +11 -11
- data/lib/antelope/ace/scanner/second.rb +2 -2
- data/lib/antelope/ace/token.rb +1 -1
- data/lib/antelope/ace.rb +2 -2
- data/lib/antelope/cli.rb +33 -0
- data/lib/antelope/errors.rb +6 -0
- data/lib/antelope/generation/constructor/first.rb +40 -6
- data/lib/antelope/generation/constructor/follow.rb +83 -25
- data/lib/antelope/generation/constructor/nullable.rb +24 -2
- data/lib/antelope/generation/constructor.rb +39 -13
- data/lib/antelope/generation/errors.rb +15 -0
- data/lib/antelope/generation/recognizer/rule.rb +111 -11
- data/lib/antelope/generation/recognizer/state.rb +53 -5
- data/lib/antelope/generation/recognizer.rb +31 -1
- data/lib/antelope/generation/tableizer.rb +42 -10
- data/lib/antelope/generation.rb +1 -1
- data/lib/antelope/generator/templates/output.erb +19 -18
- data/lib/antelope/version.rb +1 -1
- data/lib/antelope.rb +3 -2
- metadata +7 -36
- data/lib/antelope/ace/grammar/presidence.rb +0 -59
- data/lib/antelope/automaton.rb +0 -36
- data/lib/antelope/generation/conflictor/conflict.rb +0 -7
- data/lib/antelope/generation/conflictor.rb +0 -45
- data/lib/antelope/generation/constructor/lookahead.rb +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac4549b5e4618c5599316bc58c0838ff573edc2c
|
4
|
+
data.tar.gz: d7fc04521edb6b4f6d49c500e1410f683863f1a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86e201447c094f12642b131464f225e4a4b8c743813800b93b296b95ad0e77c5e2516b1a3ff43e06a1502991c2980764528ad1fa6e6a79d03b741c92d253626a
|
7
|
+
data.tar.gz: cfca26b2b0d3c01934c6647bcf01f79ee3403acd898718c3c80fe62fcaa1bd415fded4d97cb7c0d167b35180a564711c9d632764ec20534293a76d4688383b50
|
data/.yardopts
CHANGED
data/antelope.gemspec
CHANGED
@@ -18,8 +18,6 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "liquid", "~> 2.6"
|
22
|
-
spec.add_dependency "sourcify", "~> 0.5"
|
23
21
|
spec.add_dependency "hashie", "~> 3.0"
|
24
22
|
spec.add_dependency "thor", "~> 0.19"
|
25
23
|
|
data/bin/antelope
CHANGED
@@ -1,24 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
$: << File.expand_path("../../lib", __FILE__)
|
3
|
+
$: << File.expand_path("../../lib", __FILE__)
|
4
4
|
require "antelope"
|
5
|
-
require "
|
5
|
+
require "antelope/cli"
|
6
6
|
|
7
|
-
ARGV
|
8
|
-
grammar = Antelope::Ace::Grammar.from_file(program)
|
9
|
-
|
10
|
-
out = grammar.generate
|
11
|
-
|
12
|
-
#pass = Hash[[:recognizer,
|
13
|
-
# :constructor,
|
14
|
-
# :conflictor,
|
15
|
-
# :table].zip(out)]
|
16
|
-
|
17
|
-
#program = Pathname.new(program)
|
18
|
-
|
19
|
-
#file_name = program.parent + program.basename(".ace")
|
20
|
-
|
21
|
-
#File.open("#{file_name}.output", "w") do |f|
|
22
|
-
# f.write Antelope::Output.output(grammar, pass)
|
23
|
-
#end
|
24
|
-
end
|
7
|
+
Antelope::CLI.start(ARGV)
|
@@ -1,32 +1,38 @@
|
|
1
1
|
Productions:
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
e → t ";"
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
t →
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
2
|
+
s → e
|
3
|
+
e → t ";"
|
4
|
+
e → t "+" e
|
5
|
+
t → NUMBER
|
6
|
+
t → "(" e ")"
|
7
|
+
$start → s $
|
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
|
+
Precedence:
|
30
36
|
--- highest
|
31
37
|
nonassoc 1:
|
32
38
|
{_}
|
@@ -35,60 +41,48 @@ Presidence:
|
|
35
41
|
--- lowest
|
36
42
|
|
37
43
|
Table:
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
:
|
43
|
-
:
|
44
|
-
1
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
:
|
60
|
-
:
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
#<Antelope::Generation::Recognizer::Rule id=15 left=t(9:3) right=[NUMBER] position=0>,
|
81
|
-
#<Antelope::Generation::Recognizer::Rule id=16 left=t(9:3) right=["(" e(6:10) ")"] position=0>,
|
82
|
-
#<Antelope::Generation::Recognizer::Rule id=17 left=$start(0) right=[s $] position=2>,
|
83
|
-
#<Antelope::Generation::Recognizer::Rule id=18 left=e(9:11) right=[t ";"] position=2>,
|
84
|
-
#<Antelope::Generation::Recognizer::Rule id=19 left=e(9:11) right=[t "+" e] position=2>,
|
85
|
-
#<Antelope::Generation::Recognizer::Rule id=20 left=e(9:11) right=[t(9:3) ";"] position=0>,
|
86
|
-
#<Antelope::Generation::Recognizer::Rule id=21 left=e(9:11) right=[t(9:3) "+" e(9:11)] position=0>,
|
87
|
-
#<Antelope::Generation::Recognizer::Rule id=22 left=t(9:3) right=[NUMBER] position=0>,
|
88
|
-
#<Antelope::Generation::Recognizer::Rule id=23 left=t(9:3) right=["(" e(6:10) ")"] position=0>,
|
89
|
-
#<Antelope::Generation::Recognizer::Rule id=24 left=t(9:3) right=["(" e ")"] position=2>,
|
90
|
-
#<Antelope::Generation::Recognizer::Rule id=25 left=e(9:11) right=[t "+" e] position=3>,
|
91
|
-
#<Antelope::Generation::Recognizer::Rule id=26 left=t(9:3) right=["(" e ")"] position=3>]
|
44
|
+
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
|
+
|
92
86
|
|
93
87
|
State 0:
|
94
88
|
rules:
|
@@ -96,13 +90,13 @@ State 0:
|
|
96
90
|
{}
|
97
91
|
1/n1: s(0:1) → • e(0:2)
|
98
92
|
{}
|
99
|
-
2/n1: e(
|
93
|
+
2/n1: e(0:2) → • t(0:3) ";"
|
100
94
|
{}
|
101
|
-
3/n1: e(
|
95
|
+
3/n1: e(0:2) → • t(0:3) "+" e(9:11)
|
102
96
|
{}
|
103
|
-
4/n1: t(
|
97
|
+
4/n1: t(0:3) → • NUMBER
|
104
98
|
{}
|
105
|
-
5/n1: t(
|
99
|
+
5/n1: t(0:3) → • "(" e(6:10) ")"
|
106
100
|
{}
|
107
101
|
|
108
102
|
transitions:
|
@@ -114,7 +108,7 @@ State 0:
|
|
114
108
|
|
115
109
|
State 1:
|
116
110
|
rules:
|
117
|
-
6/n0: $start
|
111
|
+
6/n0: $start → s • $
|
118
112
|
{}
|
119
113
|
|
120
114
|
transitions:
|
@@ -122,16 +116,16 @@ State 1:
|
|
122
116
|
|
123
117
|
State 2:
|
124
118
|
rules:
|
125
|
-
7/n1: s
|
119
|
+
7/n1: s → e •
|
126
120
|
{$}
|
127
121
|
|
128
122
|
transitions:
|
129
123
|
|
130
124
|
State 3:
|
131
125
|
rules:
|
132
|
-
8/n1: e
|
126
|
+
8/n1: e → t • ";"
|
133
127
|
{}
|
134
|
-
10/n1: e
|
128
|
+
10/n1: e → t • "+" e
|
135
129
|
{}
|
136
130
|
|
137
131
|
transitions:
|
@@ -140,7 +134,7 @@ State 3:
|
|
140
134
|
|
141
135
|
State 4:
|
142
136
|
rules:
|
143
|
-
10/n1: e
|
137
|
+
10/n1: e → t • "+" e
|
144
138
|
{}
|
145
139
|
|
146
140
|
transitions:
|
@@ -148,22 +142,22 @@ State 4:
|
|
148
142
|
|
149
143
|
State 5:
|
150
144
|
rules:
|
151
|
-
11/n1: t
|
145
|
+
11/n1: t → NUMBER •
|
152
146
|
{";", "+"}
|
153
147
|
|
154
148
|
transitions:
|
155
149
|
|
156
150
|
State 6:
|
157
151
|
rules:
|
158
|
-
12/n1: t
|
152
|
+
12/n1: t → "(" • e ")"
|
159
153
|
{}
|
160
|
-
13/n1: e(
|
154
|
+
13/n1: e(6:10) → • t(6:3) ";"
|
161
155
|
{}
|
162
|
-
14/n1: e(
|
156
|
+
14/n1: e(6:10) → • t(6:3) "+" e(9:11)
|
163
157
|
{}
|
164
|
-
15/n1: t(
|
158
|
+
15/n1: t(6:3) → • NUMBER
|
165
159
|
{}
|
166
|
-
16/n1: t(
|
160
|
+
16/n1: t(6:3) → • "(" e(6:10) ")"
|
167
161
|
{}
|
168
162
|
|
169
163
|
transitions:
|
@@ -174,21 +168,21 @@ State 6:
|
|
174
168
|
|
175
169
|
State 7:
|
176
170
|
rules:
|
177
|
-
17/n0: $start
|
171
|
+
17/n0: $start → s $ •
|
178
172
|
{}
|
179
173
|
|
180
174
|
transitions:
|
181
175
|
|
182
176
|
State 8:
|
183
177
|
rules:
|
184
|
-
18/n1: e
|
178
|
+
18/n1: e → t ";" •
|
185
179
|
{$, ")"}
|
186
180
|
|
187
181
|
transitions:
|
188
182
|
|
189
183
|
State 9:
|
190
184
|
rules:
|
191
|
-
19/n1: e
|
185
|
+
19/n1: e → t "+" • e
|
192
186
|
{}
|
193
187
|
20/n1: e(9:11) → • t(9:3) ";"
|
194
188
|
{}
|
@@ -207,7 +201,7 @@ State 9:
|
|
207
201
|
|
208
202
|
State 10:
|
209
203
|
rules:
|
210
|
-
24/n1: t
|
204
|
+
24/n1: t → "(" e • ")"
|
211
205
|
{}
|
212
206
|
|
213
207
|
transitions:
|
@@ -215,14 +209,14 @@ State 10:
|
|
215
209
|
|
216
210
|
State 11:
|
217
211
|
rules:
|
218
|
-
25/n1: e
|
212
|
+
25/n1: e → t "+" e •
|
219
213
|
{$, ")"}
|
220
214
|
|
221
215
|
transitions:
|
222
216
|
|
223
217
|
State 12:
|
224
218
|
rules:
|
225
|
-
26/n1: t
|
219
|
+
26/n1: t → "(" e ")" •
|
226
220
|
{";", "+"}
|
227
221
|
|
228
222
|
transitions:
|