antelope 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -0
  3. data/CONTRIBUTING.md +4 -4
  4. data/GENERATORS.md +61 -19
  5. data/README.md +84 -9
  6. data/TODO.md +58 -0
  7. data/examples/deterministic.ace +21 -9
  8. data/examples/example.ace +16 -10
  9. data/examples/example.output +213 -146
  10. data/examples/simple.ace +1 -1
  11. data/lib/antelope/ace/compiler.rb +52 -15
  12. data/lib/antelope/ace/errors.rb +7 -0
  13. data/lib/antelope/ace/grammar/generation.rb +3 -3
  14. data/lib/antelope/ace/grammar/precedences.rb +5 -7
  15. data/lib/antelope/ace/grammar/productions.rb +36 -11
  16. data/lib/antelope/ace/grammar/{terminals.rb → symbols.rb} +25 -2
  17. data/lib/antelope/ace/grammar.rb +12 -3
  18. data/lib/antelope/ace/precedence.rb +4 -0
  19. data/lib/antelope/ace/scanner/argument.rb +57 -0
  20. data/lib/antelope/ace/scanner/first.rb +32 -6
  21. data/lib/antelope/ace/scanner/second.rb +23 -8
  22. data/lib/antelope/ace/scanner.rb +32 -26
  23. data/lib/antelope/ace/token.rb +21 -2
  24. data/lib/antelope/cli.rb +22 -2
  25. data/lib/antelope/generation/constructor/first.rb +1 -1
  26. data/lib/antelope/generation/constructor.rb +2 -0
  27. data/lib/antelope/generation/null.rb +13 -0
  28. data/lib/antelope/generation/recognizer/rule.rb +4 -3
  29. data/lib/antelope/generation/recognizer/state.rb +18 -3
  30. data/lib/antelope/generation/recognizer.rb +19 -24
  31. data/lib/antelope/generation/tableizer.rb +30 -2
  32. data/lib/antelope/generation.rb +1 -0
  33. data/lib/antelope/generator/base.rb +150 -13
  34. data/lib/antelope/generator/c.rb +11 -0
  35. data/lib/antelope/generator/c_header.rb +105 -0
  36. data/lib/antelope/generator/c_source.rb +39 -0
  37. data/lib/antelope/generator/null.rb +5 -0
  38. data/lib/antelope/generator/output.rb +3 -3
  39. data/lib/antelope/generator/ruby.rb +23 -5
  40. data/lib/antelope/generator/templates/c_header.ant +36 -0
  41. data/lib/antelope/generator/templates/c_source.ant +202 -0
  42. data/lib/antelope/generator/templates/output.ant +68 -0
  43. data/lib/antelope/generator/templates/ruby.ant +146 -0
  44. data/lib/antelope/generator.rb +15 -3
  45. data/lib/antelope/template/compiler.rb +78 -0
  46. data/lib/antelope/template/errors.rb +9 -0
  47. data/lib/antelope/template/scanner.rb +111 -0
  48. data/lib/antelope/template.rb +60 -0
  49. data/lib/antelope/version.rb +1 -1
  50. data/lib/antelope.rb +1 -0
  51. data/spec/antelope/template_spec.rb +39 -0
  52. data/subl/Ace (Ruby).JSON-tmLanguage +94 -0
  53. data/subl/Ace (Ruby).tmLanguage +153 -0
  54. metadata +21 -8
  55. data/examples/deterministic.output +0 -131
  56. data/examples/simple.output +0 -121
  57. data/lib/antelope/generator/templates/output.erb +0 -56
  58. data/lib/antelope/generator/templates/ruby.erb +0 -63
@@ -0,0 +1,111 @@
1
+ require 'strscan'
2
+
3
+ module Antelope
4
+ class Template
5
+ class Scanner
6
+ attr_reader :scanner
7
+
8
+ attr_reader :tokens
9
+
10
+ def initialize(input, source = "(template)")
11
+ @scanner = StringScanner.new(input)
12
+ @source = source
13
+ @tokens = nil
14
+ @line = 1
15
+ end
16
+
17
+ def scan
18
+
19
+ @tokens ||= begin
20
+ @tokens = []
21
+ @line = 1
22
+ @scanner.pos = 0
23
+ until @scanner.eos?
24
+ scan_tag || scan_until_tag || error!
25
+ end
26
+
27
+ @tokens
28
+ end
29
+
30
+ rescue SyntaxError => e
31
+ start = [@scanner.pos - 8, 0].max
32
+ stop = [@scanner.pos + 8, @scanner.string.length].min
33
+ snip = @scanner.string[start..stop].strip.inspect
34
+ char = @scanner.string[@scanner.pos]
35
+ char = if char
36
+ char.inspect
37
+ else
38
+ "EOF"
39
+ end
40
+
41
+ new_line = "#{@source}:#{@line}: unexpected #{char} " \
42
+ "(near #{snip})"
43
+
44
+ raise e, e.message, [new_line, *e.backtrace]
45
+ end
46
+
47
+ private
48
+
49
+ def scan_until_tag
50
+ if value = @scanner.scan_until(/(\n|\%|\{|\}|\\)/)
51
+ @scanner.pos -= 1
52
+ tokens << [:text, value[0..-2]]
53
+ end
54
+ end
55
+
56
+ def scan_tag
57
+ case
58
+ when @scanner.scan(/\\(\{\{|\}\}|\%)/)
59
+ tokens << [:text, @scanner[1]]
60
+ when @scanner.scan(/\n?\%\{/)
61
+ update_line
62
+ tokens << [:newline] if @scanner[0][0] == "\n"
63
+ scan_tag_start(:output_tag, :_, /\}/)
64
+ when @scanner.scan(/\n\%/)
65
+ update_line
66
+ error! unless value = @scanner.scan_until(/\n/)
67
+ @scanner.pos -= 1
68
+ tokens << [:tag, value]
69
+ when @scanner.scan(/\n?\{\{=/)
70
+ update_line
71
+ scan_tag_start(:output_tag)
72
+ when @scanner.scan(/\n?\{\{!/)
73
+ update_line
74
+ scan_tag_start(:comment_tag)
75
+ when @scanner.scan(/\n?\{\{/)
76
+ update_line
77
+ scan_tag_start(:tag)
78
+ when @scanner.scan(/\n?\}\}/)
79
+ update_line
80
+ @scanner.pos -= 2
81
+ error!
82
+ when @scanner.scan(/\n/)
83
+ update_line
84
+ tokens << [:newline]
85
+ when @scanner.scan(/\{|\}|\%|\\/)
86
+ tokens << [:text, @scanner[0]]
87
+ else
88
+ false
89
+ end
90
+ end
91
+
92
+ def scan_tag_start(type, online = :_, ending = /\}\}/)
93
+ if online == :_
94
+ online = @scanner[0][0] == "\n"
95
+ end
96
+
97
+ value = @scanner.scan_until(ending) or error!
98
+ tokens << [type, value[0..-(@scanner[0].length + 1)]]
99
+ end
100
+
101
+ def error!
102
+ raise SyntaxError, "invalid syntax"
103
+ end
104
+
105
+ def update_line
106
+ @line += @scanner[0].count("\n")
107
+ end
108
+
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,60 @@
1
+ require "antelope/template/errors"
2
+ require "antelope/template/scanner"
3
+ require "antelope/template/compiler"
4
+
5
+
6
+ module Antelope
7
+ class Template
8
+
9
+ NO_SOURCE = Object.new
10
+
11
+
12
+ def initialize(input, source = NO_SOURCE)
13
+ @input = normalize_input(input)
14
+ @source = determine_source(input, source)
15
+ end
16
+
17
+ def parse
18
+ @result ||= begin
19
+ scanner = Scanner.new(@input, @source)
20
+ compiler = Compiler.new(scanner.scan)
21
+ compiler.compile
22
+ end
23
+ end
24
+
25
+ def result(binding = TOPLEVEL_BINDING.dup)
26
+ # sue me.
27
+ eval(parse, binding, "#{@source}.rb", 0)
28
+ end
29
+
30
+ alias_method :run, :result
31
+ alias_method :call, :result
32
+
33
+ private
34
+
35
+ def normalize_input(input)
36
+ case
37
+ when String === input
38
+ input
39
+ when input.respond_to?(:read)
40
+ input.read
41
+ when input.respond_to?(:open)
42
+ input.open("r") { |f| f.read }
43
+ else
44
+ raise ArgumentError, "Received #{input.class}, expected " \
45
+ "#{String}, #read"
46
+ end
47
+ end
48
+
49
+ def determine_source(input, source)
50
+ case
51
+ when source != NO_SOURCE
52
+ source
53
+ when input.respond_to?(:to_path)
54
+ input.to_path
55
+ else
56
+ "(template)"
57
+ end
58
+ end
59
+ end
60
+ end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Antelope
4
4
  # The current running version of antelope.
5
- VERSION = "0.1.8".freeze
5
+ VERSION = "0.1.9".freeze
6
6
  end
data/lib/antelope.rb CHANGED
@@ -5,6 +5,7 @@ require "antelope/generation"
5
5
  require "antelope/generator"
6
6
  require "antelope/version"
7
7
  require "antelope/ace"
8
+ require "antelope/template"
8
9
 
9
10
  # Antelope, the compiler compiler.
10
11
  module Antelope
@@ -0,0 +1,39 @@
1
+ describe Template do
2
+
3
+ let(:content) { "hello {{ world }} test" }
4
+
5
+ subject { Template.new(content) }
6
+
7
+ it "generates ruby code" do
8
+ expect(subject.parse).to eq %Q(_out ||= ""\n_out << "hello "\nworld\n_out << " test"\n_out\n)
9
+ end
10
+
11
+ context "when the tag is on its own line" do
12
+
13
+ let :content do
14
+ <<-TEST
15
+ hello
16
+ {{= something }}
17
+ world
18
+
19
+ {{ thing }}
20
+ a
21
+
22
+ TEST
23
+ end
24
+
25
+ it "removes surrounding whitespace" do
26
+ expect(subject.parse).to eq <<-TEST
27
+ _out ||= ""
28
+ _out << "hello\\n"
29
+ _out << begin
30
+ something
31
+ end.to_s
32
+ _out << "world\\n\\n"
33
+ thing
34
+ _out << "a\\n\\n"
35
+ _out
36
+ TEST
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,94 @@
1
+ // [PackageDev] target_format: plist, ext: tmLanguage
2
+
3
+ {
4
+ "name": "Ace (Ruby Host)",
5
+ "scopeName": "source.ace.ruby",
6
+ "fileTypes": [
7
+ "ace"
8
+ ],
9
+ "uuid": "2d7fd617-f324-4476-9380-f5108efdf88d",
10
+
11
+ "patterns": [
12
+ { "include": "#firstSection" }
13
+ ],
14
+
15
+ "repository": {
16
+ "firstSection": {
17
+ "patterns": [
18
+ {
19
+ "begin": "%%",
20
+ "end": "a^",
21
+ "name": "meta.section.third.ace.ruby",
22
+ "patterns": [
23
+ { "include": "#secondSection" }
24
+ ]
25
+ },
26
+ {
27
+ "begin": "(%[A-Za-z0-9_.-]+)",
28
+ "end": "\\n",
29
+ "name": "meta.function.ace.ruby",
30
+ "beginCaptures": {
31
+ "1": { "name": "keyword.other.ace.ruby" }
32
+ },
33
+ "patterns": [
34
+ {
35
+ "match": "(<)((?:\\\\>|[^>])*)(>)",
36
+ "name": "string.quoted.other.ace.ruby"
37
+ },
38
+ {
39
+ "match": "(\\{)((?:\\\\}|[^}])*)(\\})",
40
+ "name": "string.quoted.other.ace.ruby"
41
+ },
42
+ {
43
+ "match": "(\\')((?:\\\\'|[^'])*)(\\')",
44
+ "name": "string.quoted.single.ace.ruby"
45
+ },
46
+ {
47
+ "match": "(\\\")((?:\\\\\"|[^\"])*)(\\\")",
48
+ "name": "string.quoted.double.ace.ruby"
49
+ },
50
+ {
51
+ "match": "(?<=\\s)([A-Za-z0-9_.-]+)(?=\\s)",
52
+ "name": "variable.parameter.ace.ruby"
53
+ }
54
+ ]
55
+ }
56
+ ]
57
+
58
+ },
59
+ "secondSection": {
60
+ "patterns": [
61
+ {
62
+ "begin": "%%",
63
+ "end": "a^",
64
+ "name": "meta.section.last.ace.ruby",
65
+ "patterns": [
66
+ { "include": "source.ruby" }
67
+ ]
68
+ },
69
+ {
70
+ "match": "[A-Za-z0-9._-]+:",
71
+ "name": "constant.other.symbol.ace.ruby"
72
+ },
73
+ {
74
+ "match": "(?<=\\s)[A-Z]+(?=\\s)",
75
+ "name": "variable.other.constant.ace.ruby"
76
+ },
77
+ {
78
+ "match": "\\|",
79
+ "name": "keyword.operator.ace.ruby"
80
+ },
81
+ {
82
+ "begin": "\\{",
83
+ "end": "\\}",
84
+ "patterns": [
85
+ { "include": "source.ruby" }
86
+ ]
87
+ }
88
+ ]
89
+ },
90
+ "thirdSection": {
91
+ "patterns": []
92
+ }
93
+ }
94
+ }
@@ -0,0 +1,153 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>fileTypes</key>
6
+ <array>
7
+ <string>ace</string>
8
+ </array>
9
+ <key>name</key>
10
+ <string>Ace (Ruby Host)</string>
11
+ <key>patterns</key>
12
+ <array>
13
+ <dict>
14
+ <key>include</key>
15
+ <string>#firstSection</string>
16
+ </dict>
17
+ </array>
18
+ <key>repository</key>
19
+ <dict>
20
+ <key>firstSection</key>
21
+ <dict>
22
+ <key>patterns</key>
23
+ <array>
24
+ <dict>
25
+ <key>begin</key>
26
+ <string>%%</string>
27
+ <key>end</key>
28
+ <string>a^</string>
29
+ <key>name</key>
30
+ <string>meta.section.third.ace.ruby</string>
31
+ <key>patterns</key>
32
+ <array>
33
+ <dict>
34
+ <key>include</key>
35
+ <string>#secondSection</string>
36
+ </dict>
37
+ </array>
38
+ </dict>
39
+ <dict>
40
+ <key>begin</key>
41
+ <string>(%[A-Za-z0-9_.-]+)</string>
42
+ <key>beginCaptures</key>
43
+ <dict>
44
+ <key>1</key>
45
+ <dict>
46
+ <key>name</key>
47
+ <string>keyword.other.ace.ruby</string>
48
+ </dict>
49
+ </dict>
50
+ <key>end</key>
51
+ <string>\n</string>
52
+ <key>name</key>
53
+ <string>meta.function.ace.ruby</string>
54
+ <key>patterns</key>
55
+ <array>
56
+ <dict>
57
+ <key>match</key>
58
+ <string>(&lt;)((?:\\&gt;|[^&gt;])*)(&gt;)</string>
59
+ <key>name</key>
60
+ <string>string.quoted.other.ace.ruby</string>
61
+ </dict>
62
+ <dict>
63
+ <key>match</key>
64
+ <string>(\{)((?:\\}|[^}])*)(\})</string>
65
+ <key>name</key>
66
+ <string>string.quoted.other.ace.ruby</string>
67
+ </dict>
68
+ <dict>
69
+ <key>match</key>
70
+ <string>(\')((?:\\'|[^'])*)(\')</string>
71
+ <key>name</key>
72
+ <string>string.quoted.single.ace.ruby</string>
73
+ </dict>
74
+ <dict>
75
+ <key>match</key>
76
+ <string>(\")((?:\\"|[^"])*)(\")</string>
77
+ <key>name</key>
78
+ <string>string.quoted.double.ace.ruby</string>
79
+ </dict>
80
+ <dict>
81
+ <key>match</key>
82
+ <string>(?&lt;=\s)([A-Za-z0-9_.-]+)(?=\s)</string>
83
+ <key>name</key>
84
+ <string>variable.parameter.ace.ruby</string>
85
+ </dict>
86
+ </array>
87
+ </dict>
88
+ </array>
89
+ </dict>
90
+ <key>secondSection</key>
91
+ <dict>
92
+ <key>patterns</key>
93
+ <array>
94
+ <dict>
95
+ <key>begin</key>
96
+ <string>%%</string>
97
+ <key>end</key>
98
+ <string>a^</string>
99
+ <key>name</key>
100
+ <string>meta.section.last.ace.ruby</string>
101
+ <key>patterns</key>
102
+ <array>
103
+ <dict>
104
+ <key>include</key>
105
+ <string>source.ruby</string>
106
+ </dict>
107
+ </array>
108
+ </dict>
109
+ <dict>
110
+ <key>match</key>
111
+ <string>[A-Za-z0-9._-]+:</string>
112
+ <key>name</key>
113
+ <string>constant.other.symbol.ace.ruby</string>
114
+ </dict>
115
+ <dict>
116
+ <key>match</key>
117
+ <string>(?&lt;=\s)[A-Z]+(?=\s)</string>
118
+ <key>name</key>
119
+ <string>variable.other.constant.ace.ruby</string>
120
+ </dict>
121
+ <dict>
122
+ <key>match</key>
123
+ <string>\|</string>
124
+ <key>name</key>
125
+ <string>keyword.operator.ace.ruby</string>
126
+ </dict>
127
+ <dict>
128
+ <key>begin</key>
129
+ <string>\{</string>
130
+ <key>end</key>
131
+ <string>\}</string>
132
+ <key>patterns</key>
133
+ <array>
134
+ <dict>
135
+ <key>include</key>
136
+ <string>source.ruby</string>
137
+ </dict>
138
+ </array>
139
+ </dict>
140
+ </array>
141
+ </dict>
142
+ <key>thirdSection</key>
143
+ <dict>
144
+ <key>patterns</key>
145
+ <array/>
146
+ </dict>
147
+ </dict>
148
+ <key>scopeName</key>
149
+ <string>source.ace.ruby</string>
150
+ <key>uuid</key>
151
+ <string>2d7fd617-f324-4476-9380-f5108efdf88d</string>
152
+ </dict>
153
+ </plist>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: antelope
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Rodi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-03 00:00:00.000000000 Z
11
+ date: 2014-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -112,14 +112,13 @@ files:
112
112
  - LICENSE.txt
113
113
  - README.md
114
114
  - Rakefile
115
+ - TODO.md
115
116
  - antelope.gemspec
116
117
  - bin/antelope
117
118
  - examples/deterministic.ace
118
- - examples/deterministic.output
119
119
  - examples/example.ace
120
120
  - examples/example.output
121
121
  - examples/simple.ace
122
- - examples/simple.output
123
122
  - lib/antelope.rb
124
123
  - lib/antelope/ace.rb
125
124
  - lib/antelope/ace/compiler.rb
@@ -129,10 +128,11 @@ files:
129
128
  - lib/antelope/ace/grammar/loading.rb
130
129
  - lib/antelope/ace/grammar/precedences.rb
131
130
  - lib/antelope/ace/grammar/productions.rb
132
- - lib/antelope/ace/grammar/terminals.rb
131
+ - lib/antelope/ace/grammar/symbols.rb
133
132
  - lib/antelope/ace/precedence.rb
134
133
  - lib/antelope/ace/production.rb
135
134
  - lib/antelope/ace/scanner.rb
135
+ - lib/antelope/ace/scanner/argument.rb
136
136
  - lib/antelope/ace/scanner/first.rb
137
137
  - lib/antelope/ace/scanner/second.rb
138
138
  - lib/antelope/ace/scanner/third.rb
@@ -149,26 +149,39 @@ files:
149
149
  - lib/antelope/generation/constructor/follow.rb
150
150
  - lib/antelope/generation/constructor/nullable.rb
151
151
  - lib/antelope/generation/errors.rb
152
+ - lib/antelope/generation/null.rb
152
153
  - lib/antelope/generation/recognizer.rb
153
154
  - lib/antelope/generation/recognizer/rule.rb
154
155
  - lib/antelope/generation/recognizer/state.rb
155
156
  - lib/antelope/generation/tableizer.rb
156
157
  - lib/antelope/generator.rb
157
158
  - lib/antelope/generator/base.rb
159
+ - lib/antelope/generator/c.rb
160
+ - lib/antelope/generator/c_header.rb
161
+ - lib/antelope/generator/c_source.rb
158
162
  - lib/antelope/generator/group.rb
159
163
  - lib/antelope/generator/null.rb
160
164
  - lib/antelope/generator/output.rb
161
165
  - lib/antelope/generator/ruby.rb
162
- - lib/antelope/generator/templates/output.erb
163
- - lib/antelope/generator/templates/ruby.erb
166
+ - lib/antelope/generator/templates/c_header.ant
167
+ - lib/antelope/generator/templates/c_source.ant
168
+ - lib/antelope/generator/templates/output.ant
169
+ - lib/antelope/generator/templates/ruby.ant
170
+ - lib/antelope/template.rb
171
+ - lib/antelope/template/compiler.rb
172
+ - lib/antelope/template/errors.rb
173
+ - lib/antelope/template/scanner.rb
164
174
  - lib/antelope/version.rb
165
175
  - spec/antelope/ace/compiler_spec.rb
166
176
  - spec/antelope/ace/scanner_spec.rb
167
177
  - spec/antelope/constructor_spec.rb
178
+ - spec/antelope/template_spec.rb
168
179
  - spec/fixtures/simple.ace
169
180
  - spec/spec_helper.rb
170
181
  - spec/support/benchmark_helper.rb
171
182
  - spec/support/grammar_helper.rb
183
+ - subl/Ace (Ruby).JSON-tmLanguage
184
+ - subl/Ace (Ruby).tmLanguage
172
185
  homepage: https://github.com/medcat/antelope
173
186
  licenses:
174
187
  - MIT
@@ -197,8 +210,8 @@ test_files:
197
210
  - spec/antelope/ace/compiler_spec.rb
198
211
  - spec/antelope/ace/scanner_spec.rb
199
212
  - spec/antelope/constructor_spec.rb
213
+ - spec/antelope/template_spec.rb
200
214
  - spec/fixtures/simple.ace
201
215
  - spec/spec_helper.rb
202
216
  - spec/support/benchmark_helper.rb
203
217
  - spec/support/grammar_helper.rb
204
- has_rdoc:
@@ -1,131 +0,0 @@
1
- Productions:
2
- 0 $start: s $
3
- 1 s: e
4
- 2 e: t ";"
5
- 3 e: t "+" e
6
- 4 t: NUMBER
7
- 5 t: "(" e ")"
8
-
9
- Precedence:
10
- --- highest
11
- nonassoc 1:
12
- {_}
13
- nonassoc 0:
14
- {$}
15
- --- lowest
16
-
17
- State 0:
18
- 0/n0: $start → • s $
19
- {}
20
- 1/n1: s → • e
21
- {}
22
- 2/n1: e → • t ";"
23
- {}
24
- 3/n1: e → • t "+" e
25
- {}
26
- 4/n1: t → • NUMBER
27
- {}
28
- 5/n1: t → • "(" e ")"
29
- {}
30
- transitions:
31
- s: State 1
32
- e: State 2
33
- t: State 3
34
- NUMBER: State 4
35
- "(": State 5
36
-
37
- State 1:
38
- 6/n0: $start → s • $
39
- {}
40
- transitions:
41
- $: State 6
42
-
43
- State 2:
44
- 7/n1: s → e •
45
- {$}
46
- reductions:
47
- $: Rule 1
48
-
49
- State 3:
50
- 8/n1: e → t • ";"
51
- {}
52
- 9/n1: e → t • "+" e
53
- {}
54
- transitions:
55
- ";": State 7
56
- "+": State 8
57
-
58
- State 4:
59
- 10/n1: t → NUMBER •
60
- {";", "+"}
61
- reductions:
62
- ";": Rule 4
63
- "+": Rule 4
64
-
65
- State 5:
66
- 11/n1: t → "(" • e ")"
67
- {}
68
- 12/n1: e → • t ";"
69
- {}
70
- 13/n1: e → • t "+" e
71
- {}
72
- 14/n1: t → • NUMBER
73
- {}
74
- 15/n1: t → • "(" e ")"
75
- {}
76
- transitions:
77
- e: State 9
78
- t: State 3
79
- NUMBER: State 4
80
- "(": State 5
81
-
82
- State 6:
83
- 16/n0: $start → s $ •
84
- {}
85
- accepting:
86
- $: Rule 0
87
-
88
- State 7:
89
- 17/n1: e → t ";" •
90
- {$, ")"}
91
- reductions:
92
- $: Rule 2
93
- ")": Rule 2
94
-
95
- State 8:
96
- 18/n1: e → t "+" • e
97
- {}
98
- 19/n1: e → • t ";"
99
- {}
100
- 20/n1: e → • t "+" e
101
- {}
102
- 21/n1: t → • NUMBER
103
- {}
104
- 22/n1: t → • "(" e ")"
105
- {}
106
- transitions:
107
- e: State 10
108
- t: State 3
109
- NUMBER: State 4
110
- "(": State 5
111
-
112
- State 9:
113
- 23/n1: t → "(" e • ")"
114
- {}
115
- transitions:
116
- ")": State 11
117
-
118
- State 10:
119
- 24/n1: e → t "+" e •
120
- {$, ")"}
121
- reductions:
122
- $: Rule 3
123
- ")": Rule 3
124
-
125
- State 11:
126
- 25/n1: t → "(" e ")" •
127
- {";", "+"}
128
- reductions:
129
- ";": Rule 5
130
- "+": Rule 5
131
-