dhaka 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +64 -0
- data/lib/dhaka.rb +12 -0
- data/lib/dot/dot.rb +29 -0
- data/lib/evaluator/evaluator.rb +35 -26
- data/lib/grammar/grammar.rb +42 -17
- data/lib/grammar/grammar_symbol.rb +4 -3
- data/lib/grammar/production.rb +9 -3
- data/lib/lexer/compiled_lexer.rb +46 -0
- data/lib/lexer/dfa.rb +71 -0
- data/lib/lexer/lexeme.rb +33 -0
- data/lib/lexer/lexer.rb +61 -0
- data/lib/lexer/lexer_run.rb +66 -0
- data/lib/lexer/regex_grammar.rb +368 -0
- data/lib/lexer/regex_parser.rb +1888 -0
- data/lib/lexer/regex_tokenizer.rb +14 -0
- data/lib/lexer/specification.rb +69 -0
- data/lib/lexer/state.rb +45 -0
- data/lib/lexer/state_machine.rb +37 -0
- data/lib/parser/action.rb +3 -3
- data/lib/parser/compiled_parser.rb +11 -3
- data/lib/parser/parse_result.rb +3 -5
- data/lib/parser/parse_tree.rb +6 -17
- data/lib/parser/parser.rb +15 -14
- data/lib/parser/parser_run.rb +4 -2
- data/lib/parser/parser_state.rb +16 -8
- data/lib/tokenizer/tokenizer.rb +5 -3
- data/test/arithmetic_precedence/arithmetic_precedence_lexer_specification.rb +23 -0
- data/test/arithmetic_precedence/arithmetic_precedence_parser_test.rb +4 -2
- data/test/chittagong/chittagong_driver.rb +12 -13
- data/test/chittagong/chittagong_driver_test.rb +18 -11
- data/test/chittagong/chittagong_evaluator.rb +7 -16
- data/test/chittagong/chittagong_evaluator_test.rb +7 -4
- data/test/chittagong/chittagong_grammar.rb +0 -6
- data/test/chittagong/chittagong_lexer.rb +109 -0
- data/test/chittagong/chittagong_lexer_specification.rb +39 -0
- data/test/chittagong/{chittagong_tokenizer_test.rb → chittagong_lexer_test.rb} +12 -6
- data/test/chittagong/chittagong_parser.rb +879 -0
- data/test/chittagong/chittagong_parser_test.rb +8 -10
- data/test/chittagong/chittagong_test.rb +17 -13
- data/test/compiled_parser_test.rb +7 -2
- data/test/evaluator_test.rb +0 -1
- data/test/grammar_test.rb +19 -1
- data/test/lexer_test.rb +215 -0
- data/test/parse_result_test.rb +8 -8
- data/test/parser_state_test.rb +0 -12
- metadata +21 -5
- data/test/arithmetic_precedence/arithmetic_precedence_tokenizer.rb +0 -39
- data/test/chittagong/chittagong_tokenizer.rb +0 -88
@@ -1,13 +1,15 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../dhaka_test_helper'
|
2
2
|
require File.dirname(__FILE__) + "/arithmetic_precedence_grammar"
|
3
|
-
require File.dirname(__FILE__) + "/
|
3
|
+
require File.dirname(__FILE__) + "/arithmetic_precedence_lexer_specification"
|
4
4
|
require File.dirname(__FILE__) + "/arithmetic_precedence_evaluator"
|
5
5
|
|
6
6
|
class TestArithmeticPrecedenceParser < Test::Unit::TestCase
|
7
7
|
def test_parses_arithmetic_expressions
|
8
8
|
fake_logger = FakeLogger.new
|
9
9
|
parser = Dhaka::Parser.new(ArithmeticPrecedenceGrammar, fake_logger)
|
10
|
+
lexer = Dhaka::Lexer.new(ArithmeticPrecedenceLexerSpecification)
|
10
11
|
eval(parser.compile_to_ruby_source_as(:ArithmeticPrecedenceParser))
|
12
|
+
eval(lexer.compile_to_ruby_source_as(:ArithmeticPrecedenceLexer))
|
11
13
|
|
12
14
|
assert_equal(30, fake_logger.warnings.size)
|
13
15
|
assert_equal(0, fake_logger.errors.size)
|
@@ -21,7 +23,7 @@ class TestArithmeticPrecedenceParser < Test::Unit::TestCase
|
|
21
23
|
end
|
22
24
|
|
23
25
|
def parse(input)
|
24
|
-
ArithmeticPrecedenceParser.parse(
|
26
|
+
ArithmeticPrecedenceParser.parse(ArithmeticPrecedenceLexer.lex(input))
|
25
27
|
end
|
26
28
|
|
27
29
|
def evaluate(parse_tree)
|
@@ -1,36 +1,35 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/
|
1
|
+
require File.dirname(__FILE__) + "/chittagong_lexer_specification"
|
2
2
|
require File.dirname(__FILE__) + "/chittagong_evaluator"
|
3
3
|
|
4
4
|
class ChittagongDriver
|
5
5
|
|
6
6
|
ERROR_MARKER = ">>>"
|
7
|
-
|
7
|
+
|
8
8
|
def parse_error_message unexpected_token, program
|
9
9
|
if unexpected_token.symbol_name == Dhaka::END_SYMBOL_NAME
|
10
10
|
"Unexpected end of file."
|
11
11
|
else
|
12
|
-
"Unexpected token #{unexpected_token.symbol_name}:\n#{program.insert(unexpected_token.input_position, ERROR_MARKER)}"
|
12
|
+
"Unexpected token #{unexpected_token.symbol_name}:\n#{program.dup.insert(unexpected_token.input_position, ERROR_MARKER)}"
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
def tokenize_error_message unexpected_char_index, program
|
17
|
-
"Unexpected character #{program[unexpected_char_index].chr}:\n#{program.insert(unexpected_char_index, ERROR_MARKER)}"
|
17
|
+
"Unexpected character #{program[unexpected_char_index].chr}:\n#{program.dup.insert(unexpected_char_index, ERROR_MARKER)}"
|
18
18
|
end
|
19
19
|
|
20
20
|
def evaluation_error_message evaluation_result, program
|
21
|
-
"#{evaluation_result.exception}:\n#{program.insert(evaluation_result.node.tokens[0].input_position, ERROR_MARKER)}"
|
21
|
+
"#{evaluation_result.exception}:\n#{program.dup.insert(evaluation_result.node.tokens[0].input_position, ERROR_MARKER)}"
|
22
22
|
end
|
23
23
|
|
24
24
|
# lipi:run_method
|
25
25
|
def run(program)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
return parse_error_message(parse_result.unexpected_token, program)
|
26
|
+
parse_result = ChittagongParser.parse(ChittagongLexer.lex(program))
|
27
|
+
|
28
|
+
case parse_result
|
29
|
+
when Dhaka::TokenizerErrorResult
|
30
|
+
return tokenize_error_message(parse_result.unexpected_char_index, program)
|
31
|
+
when Dhaka::ParseErrorResult
|
32
|
+
return parse_error_message(parse_result.unexpected_token, program)
|
34
33
|
end
|
35
34
|
|
36
35
|
evaluation_result = ChittagongEvaluator.new([{}], output_stream = []).
|
@@ -1,7 +1,12 @@
|
|
1
|
-
require File.dirname(__FILE__)+'/../dhaka_test_helper'
|
1
|
+
require File.dirname(__FILE__) + '/../dhaka_test_helper'
|
2
2
|
require File.dirname(__FILE__) + "/chittagong_grammar"
|
3
|
-
|
4
|
-
|
3
|
+
require File.dirname(__FILE__) + "/chittagong_lexer_specification"
|
4
|
+
begin
|
5
|
+
require File.dirname(__FILE__) + "/chittagong_parser"
|
6
|
+
require File.dirname(__FILE__) + "/chittagong_lexer"
|
7
|
+
rescue LoadError
|
8
|
+
puts "Please run the rake command in the root folder to generate the lexer and parser required for this test."
|
9
|
+
exit
|
5
10
|
end
|
6
11
|
require File.dirname(__FILE__) + "/chittagong_driver"
|
7
12
|
|
@@ -75,9 +80,9 @@ class TestChittagongDriver < Test::Unit::TestCase
|
|
75
80
|
"
|
76
81
|
|
77
82
|
assert_equal(
|
78
|
-
"66
|
79
|
-
1
|
80
|
-
2
|
83
|
+
"66.0
|
84
|
+
1.0
|
85
|
+
2.0
|
81
86
|
Undefined variable c:
|
82
87
|
|
83
88
|
x = 1
|
@@ -178,7 +183,7 @@ Undefined variable c:
|
|
178
183
|
print baz(foo(1), bar(2, 3), bar(6, 2))
|
179
184
|
|
180
185
|
"
|
181
|
-
assert_equal("18", @driver.run(program))
|
186
|
+
assert_equal("18.0", @driver.run(program))
|
182
187
|
end
|
183
188
|
|
184
189
|
def test_wrong_number_of_arguments
|
@@ -233,13 +238,15 @@ Undefined variable c:
|
|
233
238
|
def test_catches_bad_decimal_points
|
234
239
|
program = "
|
235
240
|
a = .234
|
236
|
-
|
241
|
+
c = 23.523
|
242
|
+
b = 20..2
|
237
243
|
"
|
238
244
|
|
239
|
-
assert_equal("Unexpected
|
245
|
+
assert_equal("Unexpected character .:
|
240
246
|
|
241
247
|
a = .234
|
242
|
-
|
248
|
+
c = 23.523
|
249
|
+
b = 20.>>>.2
|
243
250
|
", @driver.run(program))
|
244
251
|
end
|
245
252
|
# lipi:recursive_fib
|
@@ -263,7 +270,7 @@ Undefined variable c:
|
|
263
270
|
end
|
264
271
|
|
265
272
|
"
|
266
|
-
assert_equal(["1", "1", "2", "3", "5", "8", "13", "21", "34"].join("\n"), @driver.run(program))
|
273
|
+
assert_equal(["1.0", "1.0", "2.0", "3.0", "5.0", "8.0", "13.0", "21.0", "34.0"].join("\n"), @driver.run(program))
|
267
274
|
end
|
268
275
|
# lipi:recursive_fib
|
269
276
|
end
|
@@ -168,19 +168,6 @@ class ChittagongEvaluator < Dhaka::Evaluator
|
|
168
168
|
ChittagongSuccessResult.new(@stack[-1][variable_name])
|
169
169
|
end
|
170
170
|
|
171
|
-
|
172
|
-
for_float_without_leading_digits do
|
173
|
-
ChittagongSuccessResult.new(('.' + child_nodes[1].token.value).to_f)
|
174
|
-
end
|
175
|
-
|
176
|
-
for_float_with_leading_digits do
|
177
|
-
ChittagongSuccessResult.new((child_nodes[0].token.value + '.' +child_nodes[2].token.value).to_f)
|
178
|
-
end
|
179
|
-
|
180
|
-
for_integer do
|
181
|
-
ChittagongSuccessResult.new(child_nodes[0].token.value.to_i)
|
182
|
-
end
|
183
|
-
|
184
171
|
for_subtraction do
|
185
172
|
checked_binary_operation(child_nodes[0], child_nodes[2]){|a, b| a - b}
|
186
173
|
end
|
@@ -250,15 +237,19 @@ class ChittagongEvaluator < Dhaka::Evaluator
|
|
250
237
|
for_arg_declaration do
|
251
238
|
token_value
|
252
239
|
end
|
240
|
+
|
241
|
+
for_literal do
|
242
|
+
ChittagongSuccessResult.new(token_value.to_f)
|
243
|
+
end
|
253
244
|
|
254
245
|
def token_value
|
255
246
|
child_nodes.first.token.value
|
256
247
|
end
|
257
248
|
# lipi:initialize
|
258
249
|
def initialize(stack, output_stream)
|
259
|
-
@stack
|
250
|
+
@stack = stack
|
260
251
|
@function_table = {}
|
261
|
-
@output_stream
|
252
|
+
@output_stream = output_stream
|
262
253
|
end
|
263
254
|
# lipi:initialize
|
264
255
|
end
|
@@ -280,7 +271,7 @@ class ChittagongExceptionResult < ChittagongResult
|
|
280
271
|
attr_reader :node
|
281
272
|
def initialize(exception, node)
|
282
273
|
@exception = exception
|
283
|
-
@node
|
274
|
+
@node = node
|
284
275
|
end
|
285
276
|
end
|
286
277
|
|
@@ -1,14 +1,17 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../dhaka_test_helper'
|
2
2
|
require File.dirname(__FILE__) + "/chittagong_evaluator"
|
3
|
-
|
4
|
-
|
3
|
+
begin
|
4
|
+
require File.dirname(__FILE__) + "/chittagong_parser"
|
5
|
+
rescue LoadError
|
6
|
+
puts "Please run the rake command in the root folder to generate the lexer and parser required for this test."
|
7
|
+
exit
|
5
8
|
end
|
6
9
|
|
7
10
|
class TestChittagongEvaluator < Test::Unit::TestCase
|
8
11
|
def test_evaluates_a_simple_program
|
9
12
|
token_stream = build_tokens(
|
10
13
|
['newline'],
|
11
|
-
['word_literal', 'x'], ['='], ['
|
14
|
+
['word_literal', 'x'], ['='], ['numeric_literal', 23], ['newline'],
|
12
15
|
['print'], ['word_literal', 'x'], ['newline'],
|
13
16
|
['newline'],
|
14
17
|
['word_literal', 'y'], ['='], ['word_literal', 'x'], ['+'], ['word_literal', 'x'], ['newline'],
|
@@ -26,7 +29,7 @@ class TestChittagongEvaluator < Test::Unit::TestCase
|
|
26
29
|
ChittagongEvaluator.new(stack, output_stream).evaluate(ChittagongParser.parse(token_stream))
|
27
30
|
assert_equal(23, stack[0]['x'])
|
28
31
|
assert_equal(46, stack[0]['y'])
|
29
|
-
assert_equal([
|
32
|
+
assert_equal(["23.0", "1058.0", "46.0"], output_stream)
|
30
33
|
end
|
31
34
|
|
32
35
|
def build_tokens *tokens
|
@@ -91,12 +91,6 @@ class ChittagongGrammar < Dhaka::Grammar
|
|
91
91
|
end
|
92
92
|
# lipi:expressions
|
93
93
|
|
94
|
-
for_symbol('numeric_literal') do
|
95
|
-
integer %w| int_literal |
|
96
|
-
float_with_leading_digits %w| int_literal . int_literal |
|
97
|
-
float_without_leading_digits %w| . int_literal |
|
98
|
-
end
|
99
|
-
|
100
94
|
for_symbol('terms') do
|
101
95
|
single_term %w| newline |
|
102
96
|
multiple_terms %w| terms newline |
|
@@ -0,0 +1,109 @@
|
|
1
|
+
class ChittagongLexer < Dhaka::CompiledLexer
|
2
|
+
|
3
|
+
self.specification = ChittagongLexerSpecification
|
4
|
+
|
5
|
+
start_with 25917940
|
6
|
+
|
7
|
+
at_state(25901470) {
|
8
|
+
recognize("\\)")
|
9
|
+
}
|
10
|
+
|
11
|
+
at_state(25901730) {
|
12
|
+
recognize(",")
|
13
|
+
}
|
14
|
+
|
15
|
+
at_state(25902250) {
|
16
|
+
recognize("\\/")
|
17
|
+
}
|
18
|
+
|
19
|
+
at_state(25911660) {
|
20
|
+
recognize("==")
|
21
|
+
}
|
22
|
+
|
23
|
+
at_state(25910420) {
|
24
|
+
recognize("\\w+")
|
25
|
+
for_characters("K", "V", "k", "v", "W", "A", "L", "w", "l", "a", "b", "M", "B", "X", "m", "x", "c", "Y", "C", "N", "y", "n", "O", "D", "Z", "o", "z", "d", "p", "e", "E", "P", "f", "Q", "F", "q", "G", "R", "r", "g", "S", "H", "s", "h", "I", "T", "i", "t", "U", "J", "u", "j") { switch_to 25910420 }
|
26
|
+
}
|
27
|
+
|
28
|
+
at_state(25912350) {
|
29
|
+
recognize("!")
|
30
|
+
}
|
31
|
+
|
32
|
+
at_state(25916370) {
|
33
|
+
for_characters("6", "7", "8", "9", "0", "1", "2", "3", "4", "5") { switch_to 25915990 }
|
34
|
+
}
|
35
|
+
|
36
|
+
at_state(25916950) {
|
37
|
+
recognize("\\d*(\\.\\d+)?")
|
38
|
+
for_characters(".") { switch_to 25916370 }
|
39
|
+
for_characters("6", "7", "8", "9", "0", "1", "2", "3", "4", "5") { switch_to 25916950 }
|
40
|
+
}
|
41
|
+
|
42
|
+
at_state(25911030) {
|
43
|
+
recognize("<")
|
44
|
+
}
|
45
|
+
|
46
|
+
at_state(25902770) {
|
47
|
+
recognize(" ")
|
48
|
+
}
|
49
|
+
|
50
|
+
at_state(25917260) {
|
51
|
+
recognize("\\(")
|
52
|
+
}
|
53
|
+
|
54
|
+
at_state(25912660) {
|
55
|
+
recognize("-")
|
56
|
+
}
|
57
|
+
|
58
|
+
at_state(25901210) {
|
59
|
+
recognize("\\^")
|
60
|
+
}
|
61
|
+
|
62
|
+
at_state(25912040) {
|
63
|
+
recognize("=")
|
64
|
+
for_characters("=") { switch_to 25911660 }
|
65
|
+
}
|
66
|
+
|
67
|
+
at_state(25902510) {
|
68
|
+
recognize("\n")
|
69
|
+
}
|
70
|
+
|
71
|
+
at_state(25910730) {
|
72
|
+
recognize("\\*")
|
73
|
+
}
|
74
|
+
|
75
|
+
at_state(25911340) {
|
76
|
+
recognize(">")
|
77
|
+
}
|
78
|
+
|
79
|
+
at_state(25901990) {
|
80
|
+
recognize("\\+")
|
81
|
+
}
|
82
|
+
|
83
|
+
at_state(25915990) {
|
84
|
+
recognize("\\d*(\\.\\d+)?")
|
85
|
+
for_characters("6", "7", "8", "9", "0", "1", "2", "3", "4", "5") { switch_to 25915990 }
|
86
|
+
}
|
87
|
+
|
88
|
+
at_state(25917940) {
|
89
|
+
recognize("\\d*(\\.\\d+)?")
|
90
|
+
for_characters("^") { switch_to 25901210 }
|
91
|
+
for_characters("/") { switch_to 25902250 }
|
92
|
+
for_characters("=") { switch_to 25912040 }
|
93
|
+
for_characters("(") { switch_to 25917260 }
|
94
|
+
for_characters(")") { switch_to 25901470 }
|
95
|
+
for_characters("\n") { switch_to 25902510 }
|
96
|
+
for_characters(".") { switch_to 25916370 }
|
97
|
+
for_characters("!") { switch_to 25912350 }
|
98
|
+
for_characters("<") { switch_to 25911030 }
|
99
|
+
for_characters(",") { switch_to 25901730 }
|
100
|
+
for_characters("J", "o", "p", "K", "q", "L", "r", "M", "s", "N", "t", "O", "a", "u", "P", "b", "Q", "c", "v", "R", "d", "w", "S", "e", "x", "T", "f", "y", "A", "U", "g", "z", "B", "h", "C", "V", "i", "D", "W", "j", "E", "X", "F", "Y", "k", "G", "Z", "l", "H", "m", "I", "n") { switch_to 25910420 }
|
101
|
+
for_characters(" ") { switch_to 25902770 }
|
102
|
+
for_characters("-") { switch_to 25912660 }
|
103
|
+
for_characters(">") { switch_to 25911340 }
|
104
|
+
for_characters("+") { switch_to 25901990 }
|
105
|
+
for_characters("8", "9", "0", "1", "2", "3", "4", "5", "6", "7") { switch_to 25916950 }
|
106
|
+
for_characters("*") { switch_to 25910730 }
|
107
|
+
}
|
108
|
+
|
109
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# lipi:lexer_spec
|
2
|
+
class ChittagongLexerSpecification < Dhaka::LexerSpecification
|
3
|
+
KEYWORDS = %w| print if else end while def return |
|
4
|
+
|
5
|
+
%w| == = - ! > < , |.each do |chars|
|
6
|
+
for_pattern(chars) do
|
7
|
+
create_token(chars)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
%w| + * ( ) / ^ |.each do |char|
|
12
|
+
for_pattern("\\#{char}") do
|
13
|
+
create_token(char)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
for_pattern("\n") do
|
18
|
+
create_token('newline')
|
19
|
+
end
|
20
|
+
|
21
|
+
for_pattern(' ') do
|
22
|
+
# ignore whitespace
|
23
|
+
end
|
24
|
+
|
25
|
+
#lipi:keywords
|
26
|
+
for_pattern('\w+') do
|
27
|
+
if KEYWORDS.include? current_lexeme.value
|
28
|
+
create_token current_lexeme.value
|
29
|
+
else
|
30
|
+
create_token 'word_literal'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
#lipi:keywords
|
34
|
+
|
35
|
+
for_pattern('\d*(\.\d+)?') do
|
36
|
+
create_token('numeric_literal')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
# lipi:lexer_spec
|
@@ -1,7 +1,13 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../dhaka_test_helper'
|
2
|
-
require File.dirname(__FILE__) + "/
|
2
|
+
require File.dirname(__FILE__) + "/chittagong_lexer_specification"
|
3
|
+
begin
|
4
|
+
require File.dirname(__FILE__) + "/chittagong_lexer"
|
5
|
+
rescue LoadError
|
6
|
+
puts "Please run the rake command in the root folder to generate the lexer and parser required for this test."
|
7
|
+
exit
|
8
|
+
end
|
3
9
|
|
4
|
-
class
|
10
|
+
class TestChittagongLexer < Test::Unit::TestCase
|
5
11
|
def test_tokenizes_a_program
|
6
12
|
input = "
|
7
13
|
x = 2 * 4
|
@@ -16,13 +22,13 @@ class TestChittagongTokenizer < Test::Unit::TestCase
|
|
16
22
|
assert_equal(["newline",
|
17
23
|
"word_literal",
|
18
24
|
"=",
|
19
|
-
"
|
25
|
+
"numeric_literal",
|
20
26
|
"*",
|
21
|
-
"
|
27
|
+
"numeric_literal",
|
22
28
|
"newline",
|
23
29
|
"word_literal",
|
24
30
|
"=",
|
25
|
-
"
|
31
|
+
"numeric_literal",
|
26
32
|
"*",
|
27
33
|
"word_literal",
|
28
34
|
"newline",
|
@@ -47,6 +53,6 @@ class TestChittagongTokenizer < Test::Unit::TestCase
|
|
47
53
|
"newline",
|
48
54
|
"end",
|
49
55
|
"newline",
|
50
|
-
Dhaka::END_SYMBOL_NAME],
|
56
|
+
Dhaka::END_SYMBOL_NAME], ChittagongLexer.lex(input).collect {|token| token.symbol_name})
|
51
57
|
end
|
52
58
|
end
|
@@ -0,0 +1,879 @@
|
|
1
|
+
class ChittagongParser < Dhaka::CompiledParser
|
2
|
+
|
3
|
+
self.grammar = ChittagongGrammar
|
4
|
+
|
5
|
+
start_with 0
|
6
|
+
|
7
|
+
at_state(103) {
|
8
|
+
for_symbols("_End_") { reduce_with "program" }
|
9
|
+
}
|
10
|
+
|
11
|
+
at_state(93) {
|
12
|
+
for_symbols("_End_", "newline") { reduce_with "multiple_main_body_statements" }
|
13
|
+
}
|
14
|
+
|
15
|
+
at_state(87) {
|
16
|
+
for_symbols("==") { shift_to 22 }
|
17
|
+
for_symbols(">") { shift_to 10 }
|
18
|
+
for_symbols("/") { shift_to 18 }
|
19
|
+
for_symbols("newline") { shift_to 1 }
|
20
|
+
for_symbols("^") { shift_to 20 }
|
21
|
+
for_symbols("*") { shift_to 24 }
|
22
|
+
for_symbols("-") { shift_to 16 }
|
23
|
+
for_symbols("<") { shift_to 14 }
|
24
|
+
for_symbols("terms") { shift_to 88 }
|
25
|
+
for_symbols("+") { shift_to 12 }
|
26
|
+
}
|
27
|
+
|
28
|
+
at_state(76) {
|
29
|
+
for_symbols("function_name") { shift_to 62 }
|
30
|
+
for_symbols("var_name") { shift_to 66 }
|
31
|
+
for_symbols("return") { shift_to 60 }
|
32
|
+
for_symbols("newline") { shift_to 58 }
|
33
|
+
for_symbols("function_body") { shift_to 77 }
|
34
|
+
for_symbols("while") { shift_to 53 }
|
35
|
+
for_symbols("if") { shift_to 49 }
|
36
|
+
for_symbols("print") { shift_to 70 }
|
37
|
+
for_symbols("simple_statement") { shift_to 52 }
|
38
|
+
for_symbols("word_literal") { shift_to 27 }
|
39
|
+
for_symbols("function_body_statement") { shift_to 72 }
|
40
|
+
}
|
41
|
+
|
42
|
+
at_state(6) {
|
43
|
+
for_symbols("(") { shift_to 7 }
|
44
|
+
}
|
45
|
+
|
46
|
+
at_state(39) {
|
47
|
+
for_symbols("_End_", "newline") { reduce_with "main_body_simple_statement" }
|
48
|
+
}
|
49
|
+
|
50
|
+
at_state(14) {
|
51
|
+
for_symbols("(") { shift_to 28 }
|
52
|
+
for_symbols("-") { shift_to 5 }
|
53
|
+
for_symbols("numeric_literal") { shift_to 26 }
|
54
|
+
for_symbols("var_name") { shift_to 8 }
|
55
|
+
for_symbols("function_name") { shift_to 6 }
|
56
|
+
for_symbols("expression") { shift_to 15 }
|
57
|
+
for_symbols("!") { shift_to 4 }
|
58
|
+
for_symbols("word_literal") { shift_to 27 }
|
59
|
+
}
|
60
|
+
|
61
|
+
at_state(16) {
|
62
|
+
for_symbols("(") { shift_to 28 }
|
63
|
+
for_symbols("expression") { shift_to 17 }
|
64
|
+
for_symbols("-") { shift_to 5 }
|
65
|
+
for_symbols("numeric_literal") { shift_to 26 }
|
66
|
+
for_symbols("var_name") { shift_to 8 }
|
67
|
+
for_symbols("function_name") { shift_to 6 }
|
68
|
+
for_symbols("!") { shift_to 4 }
|
69
|
+
for_symbols("word_literal") { shift_to 27 }
|
70
|
+
}
|
71
|
+
|
72
|
+
at_state(12) {
|
73
|
+
for_symbols("(") { shift_to 28 }
|
74
|
+
for_symbols("-") { shift_to 5 }
|
75
|
+
for_symbols("numeric_literal") { shift_to 26 }
|
76
|
+
for_symbols("var_name") { shift_to 8 }
|
77
|
+
for_symbols("function_name") { shift_to 6 }
|
78
|
+
for_symbols("!") { shift_to 4 }
|
79
|
+
for_symbols("expression") { shift_to 13 }
|
80
|
+
for_symbols("word_literal") { shift_to 27 }
|
81
|
+
}
|
82
|
+
|
83
|
+
at_state(0) {
|
84
|
+
for_symbols("opt_terms") { shift_to 2 }
|
85
|
+
for_symbols("word_literal", "def", "print", "if", "while") { reduce_with "no_terms" }
|
86
|
+
for_symbols("newline") { shift_to 1 }
|
87
|
+
for_symbols("terms") { shift_to 105 }
|
88
|
+
}
|
89
|
+
|
90
|
+
at_state(85) {
|
91
|
+
for_symbols("(") { reduce_with "function_name" }
|
92
|
+
}
|
93
|
+
|
94
|
+
at_state(82) {
|
95
|
+
for_symbols("function_name") { shift_to 62 }
|
96
|
+
for_symbols("var_name") { shift_to 66 }
|
97
|
+
for_symbols("return") { shift_to 60 }
|
98
|
+
for_symbols("newline") { shift_to 58 }
|
99
|
+
for_symbols("function_body_statement") { shift_to 69 }
|
100
|
+
for_symbols("while") { shift_to 53 }
|
101
|
+
for_symbols("end") { shift_to 83 }
|
102
|
+
for_symbols("if") { shift_to 49 }
|
103
|
+
for_symbols("print") { shift_to 70 }
|
104
|
+
for_symbols("simple_statement") { shift_to 52 }
|
105
|
+
for_symbols("word_literal") { shift_to 27 }
|
106
|
+
}
|
107
|
+
|
108
|
+
at_state(22) {
|
109
|
+
for_symbols("(") { shift_to 28 }
|
110
|
+
for_symbols("-") { shift_to 5 }
|
111
|
+
for_symbols("numeric_literal") { shift_to 26 }
|
112
|
+
for_symbols("var_name") { shift_to 8 }
|
113
|
+
for_symbols("function_name") { shift_to 6 }
|
114
|
+
for_symbols("expression") { shift_to 23 }
|
115
|
+
for_symbols("!") { shift_to 4 }
|
116
|
+
for_symbols("word_literal") { shift_to 27 }
|
117
|
+
}
|
118
|
+
|
119
|
+
at_state(19) {
|
120
|
+
for_symbols("^") { shift_to 20 }
|
121
|
+
for_symbols("==", "+", ",", "-", "/", "<", "_End_", ">", ")", "newline", "*") { reduce_with "division" }
|
122
|
+
}
|
123
|
+
|
124
|
+
at_state(100) {
|
125
|
+
for_symbols("_End_", "newline") { reduce_with "main_body_if_else_statement" }
|
126
|
+
}
|
127
|
+
|
128
|
+
at_state(75) {
|
129
|
+
for_symbols("newline") { shift_to 1 }
|
130
|
+
for_symbols("terms") { shift_to 76 }
|
131
|
+
}
|
132
|
+
|
133
|
+
at_state(43) {
|
134
|
+
for_symbols(")") { shift_to 47 }
|
135
|
+
for_symbols(",") { shift_to 44 }
|
136
|
+
}
|
137
|
+
|
138
|
+
at_state(52) {
|
139
|
+
for_symbols("newline") { reduce_with "function_body_simple_statement" }
|
140
|
+
}
|
141
|
+
|
142
|
+
at_state(2) {
|
143
|
+
for_symbols("function_name") { shift_to 62 }
|
144
|
+
for_symbols("var_name") { shift_to 66 }
|
145
|
+
for_symbols("main_body_statement") { shift_to 89 }
|
146
|
+
for_symbols("while") { shift_to 86 }
|
147
|
+
for_symbols("def") { shift_to 40 }
|
148
|
+
for_symbols("if") { shift_to 3 }
|
149
|
+
for_symbols("print") { shift_to 70 }
|
150
|
+
for_symbols("simple_statement") { shift_to 39 }
|
151
|
+
for_symbols("main_body") { shift_to 102 }
|
152
|
+
for_symbols("word_literal") { shift_to 27 }
|
153
|
+
}
|
154
|
+
|
155
|
+
at_state(11) {
|
156
|
+
for_symbols("/") { shift_to 18 }
|
157
|
+
for_symbols("^") { shift_to 20 }
|
158
|
+
for_symbols("==", ",", "_End_", ")", "newline") { reduce_with "greater_than_comparison" }
|
159
|
+
for_symbols("*") { shift_to 24 }
|
160
|
+
for_symbols("-") { shift_to 16 }
|
161
|
+
for_symbols("+") { shift_to 12 }
|
162
|
+
}
|
163
|
+
|
164
|
+
at_state(72) {
|
165
|
+
for_symbols("newline") { reduce_with "single_function_body_statement" }
|
166
|
+
}
|
167
|
+
|
168
|
+
at_state(50) {
|
169
|
+
for_symbols("==") { shift_to 22 }
|
170
|
+
for_symbols(">") { shift_to 10 }
|
171
|
+
for_symbols("/") { shift_to 18 }
|
172
|
+
for_symbols("newline") { shift_to 1 }
|
173
|
+
for_symbols("^") { shift_to 20 }
|
174
|
+
for_symbols("*") { shift_to 24 }
|
175
|
+
for_symbols("-") { shift_to 16 }
|
176
|
+
for_symbols("terms") { shift_to 51 }
|
177
|
+
for_symbols("<") { shift_to 14 }
|
178
|
+
for_symbols("+") { shift_to 12 }
|
179
|
+
}
|
180
|
+
|
181
|
+
at_state(37) {
|
182
|
+
for_symbols("==") { shift_to 22 }
|
183
|
+
for_symbols(">") { shift_to 10 }
|
184
|
+
for_symbols("/") { shift_to 18 }
|
185
|
+
for_symbols("newline") { shift_to 1 }
|
186
|
+
for_symbols("^") { shift_to 20 }
|
187
|
+
for_symbols("*") { shift_to 24 }
|
188
|
+
for_symbols("-") { shift_to 16 }
|
189
|
+
for_symbols("<") { shift_to 14 }
|
190
|
+
for_symbols("terms") { shift_to 38 }
|
191
|
+
for_symbols("+") { shift_to 12 }
|
192
|
+
}
|
193
|
+
|
194
|
+
at_state(38) {
|
195
|
+
for_symbols("function_name") { shift_to 62 }
|
196
|
+
for_symbols("var_name") { shift_to 66 }
|
197
|
+
for_symbols("main_body_statement") { shift_to 89 }
|
198
|
+
for_symbols("while") { shift_to 86 }
|
199
|
+
for_symbols("newline") { shift_to 58 }
|
200
|
+
for_symbols("def") { shift_to 40 }
|
201
|
+
for_symbols("if") { shift_to 3 }
|
202
|
+
for_symbols("print") { shift_to 70 }
|
203
|
+
for_symbols("simple_statement") { shift_to 39 }
|
204
|
+
for_symbols("main_body") { shift_to 94 }
|
205
|
+
for_symbols("word_literal") { shift_to 27 }
|
206
|
+
}
|
207
|
+
|
208
|
+
at_state(62) {
|
209
|
+
for_symbols("(") { shift_to 63 }
|
210
|
+
}
|
211
|
+
|
212
|
+
at_state(49) {
|
213
|
+
for_symbols("(") { shift_to 28 }
|
214
|
+
for_symbols("expression") { shift_to 50 }
|
215
|
+
for_symbols("-") { shift_to 5 }
|
216
|
+
for_symbols("numeric_literal") { shift_to 26 }
|
217
|
+
for_symbols("var_name") { shift_to 8 }
|
218
|
+
for_symbols("function_name") { shift_to 6 }
|
219
|
+
for_symbols("!") { shift_to 4 }
|
220
|
+
for_symbols("word_literal") { shift_to 27 }
|
221
|
+
}
|
222
|
+
|
223
|
+
at_state(81) {
|
224
|
+
for_symbols("terms") { shift_to 82 }
|
225
|
+
for_symbols("newline") { shift_to 1 }
|
226
|
+
}
|
227
|
+
|
228
|
+
at_state(70) {
|
229
|
+
for_symbols("(") { shift_to 28 }
|
230
|
+
for_symbols("-") { shift_to 5 }
|
231
|
+
for_symbols("expression") { shift_to 71 }
|
232
|
+
for_symbols("numeric_literal") { shift_to 26 }
|
233
|
+
for_symbols("var_name") { shift_to 8 }
|
234
|
+
for_symbols("function_name") { shift_to 6 }
|
235
|
+
for_symbols("!") { shift_to 4 }
|
236
|
+
for_symbols("word_literal") { shift_to 27 }
|
237
|
+
}
|
238
|
+
|
239
|
+
at_state(7) {
|
240
|
+
for_symbols("(") { shift_to 28 }
|
241
|
+
for_symbols("arg_list") { shift_to 31 }
|
242
|
+
for_symbols("-") { shift_to 5 }
|
243
|
+
for_symbols("numeric_literal") { shift_to 26 }
|
244
|
+
for_symbols("expression") { shift_to 9 }
|
245
|
+
for_symbols("var_name") { shift_to 8 }
|
246
|
+
for_symbols("function_name") { shift_to 6 }
|
247
|
+
for_symbols("!") { shift_to 4 }
|
248
|
+
for_symbols(",", ")") { reduce_with "no_args" }
|
249
|
+
for_symbols("word_literal") { shift_to 27 }
|
250
|
+
}
|
251
|
+
|
252
|
+
at_state(55) {
|
253
|
+
for_symbols("function_name") { shift_to 62 }
|
254
|
+
for_symbols("var_name") { shift_to 66 }
|
255
|
+
for_symbols("return") { shift_to 60 }
|
256
|
+
for_symbols("function_body") { shift_to 56 }
|
257
|
+
for_symbols("newline") { shift_to 58 }
|
258
|
+
for_symbols("while") { shift_to 53 }
|
259
|
+
for_symbols("if") { shift_to 49 }
|
260
|
+
for_symbols("print") { shift_to 70 }
|
261
|
+
for_symbols("simple_statement") { shift_to 52 }
|
262
|
+
for_symbols("word_literal") { shift_to 27 }
|
263
|
+
for_symbols("function_body_statement") { shift_to 72 }
|
264
|
+
}
|
265
|
+
|
266
|
+
at_state(9) {
|
267
|
+
for_symbols("==") { shift_to 22 }
|
268
|
+
for_symbols(">") { shift_to 10 }
|
269
|
+
for_symbols("/") { shift_to 18 }
|
270
|
+
for_symbols(",", ")") { reduce_with "single_arg" }
|
271
|
+
for_symbols("^") { shift_to 20 }
|
272
|
+
for_symbols("*") { shift_to 24 }
|
273
|
+
for_symbols("-") { shift_to 16 }
|
274
|
+
for_symbols("<") { shift_to 14 }
|
275
|
+
for_symbols("+") { shift_to 12 }
|
276
|
+
}
|
277
|
+
|
278
|
+
at_state(105) {
|
279
|
+
for_symbols("newline") { shift_to 58 }
|
280
|
+
for_symbols("word_literal", "def", "print", "if", "while") { reduce_with "some_terms" }
|
281
|
+
}
|
282
|
+
|
283
|
+
at_state(83) {
|
284
|
+
for_symbols("_End_", "newline") { reduce_with "function_definition" }
|
285
|
+
}
|
286
|
+
|
287
|
+
at_state(15) {
|
288
|
+
for_symbols("/") { shift_to 18 }
|
289
|
+
for_symbols("^") { shift_to 20 }
|
290
|
+
for_symbols("==", ",", "_End_", ")", "newline") { reduce_with "less_than_comparison" }
|
291
|
+
for_symbols("*") { shift_to 24 }
|
292
|
+
for_symbols("-") { shift_to 16 }
|
293
|
+
for_symbols("+") { shift_to 12 }
|
294
|
+
}
|
295
|
+
|
296
|
+
at_state(32) {
|
297
|
+
for_symbols("(") { shift_to 28 }
|
298
|
+
for_symbols("-") { shift_to 5 }
|
299
|
+
for_symbols("numeric_literal") { shift_to 26 }
|
300
|
+
for_symbols("var_name") { shift_to 8 }
|
301
|
+
for_symbols("function_name") { shift_to 6 }
|
302
|
+
for_symbols("expression") { shift_to 33 }
|
303
|
+
for_symbols("!") { shift_to 4 }
|
304
|
+
for_symbols("word_literal") { shift_to 27 }
|
305
|
+
}
|
306
|
+
|
307
|
+
at_state(63) {
|
308
|
+
for_symbols("(") { shift_to 28 }
|
309
|
+
for_symbols("-") { shift_to 5 }
|
310
|
+
for_symbols("numeric_literal") { shift_to 26 }
|
311
|
+
for_symbols("expression") { shift_to 9 }
|
312
|
+
for_symbols("var_name") { shift_to 8 }
|
313
|
+
for_symbols("function_name") { shift_to 6 }
|
314
|
+
for_symbols("!") { shift_to 4 }
|
315
|
+
for_symbols("arg_list") { shift_to 64 }
|
316
|
+
for_symbols(",", ")") { reduce_with "no_args" }
|
317
|
+
for_symbols("word_literal") { shift_to 27 }
|
318
|
+
}
|
319
|
+
|
320
|
+
at_state(90) {
|
321
|
+
for_symbols("terms") { shift_to 91 }
|
322
|
+
for_symbols("newline") { shift_to 1 }
|
323
|
+
}
|
324
|
+
|
325
|
+
at_state(64) {
|
326
|
+
for_symbols(")") { shift_to 65 }
|
327
|
+
for_symbols(",") { shift_to 32 }
|
328
|
+
}
|
329
|
+
|
330
|
+
at_state(61) {
|
331
|
+
for_symbols("==") { shift_to 22 }
|
332
|
+
for_symbols(">") { shift_to 10 }
|
333
|
+
for_symbols("/") { shift_to 18 }
|
334
|
+
for_symbols("newline") { reduce_with "return_statement" }
|
335
|
+
for_symbols("^") { shift_to 20 }
|
336
|
+
for_symbols("*") { shift_to 24 }
|
337
|
+
for_symbols("-") { shift_to 16 }
|
338
|
+
for_symbols("<") { shift_to 14 }
|
339
|
+
for_symbols("+") { shift_to 12 }
|
340
|
+
}
|
341
|
+
|
342
|
+
at_state(17) {
|
343
|
+
for_symbols("/") { shift_to 18 }
|
344
|
+
for_symbols("==", "+", ",", "-", "<", "_End_", ">", ")", "newline") { reduce_with "subtraction" }
|
345
|
+
for_symbols("^") { shift_to 20 }
|
346
|
+
for_symbols("*") { shift_to 24 }
|
347
|
+
}
|
348
|
+
|
349
|
+
at_state(30) {
|
350
|
+
for_symbols("==", "+", ",", "-", "/", "<", "_End_", "^", ">", ")", "newline", "*") { reduce_with "parenthetized_expression" }
|
351
|
+
}
|
352
|
+
|
353
|
+
at_state(59) {
|
354
|
+
for_symbols("newline") { reduce_with "function_body_while_statement" }
|
355
|
+
}
|
356
|
+
|
357
|
+
at_state(89) {
|
358
|
+
for_symbols("_End_", "newline") { reduce_with "single_main_body_statement" }
|
359
|
+
}
|
360
|
+
|
361
|
+
at_state(88) {
|
362
|
+
for_symbols("function_name") { shift_to 62 }
|
363
|
+
for_symbols("var_name") { shift_to 66 }
|
364
|
+
for_symbols("main_body_statement") { shift_to 89 }
|
365
|
+
for_symbols("main_body") { shift_to 90 }
|
366
|
+
for_symbols("while") { shift_to 86 }
|
367
|
+
for_symbols("newline") { shift_to 58 }
|
368
|
+
for_symbols("def") { shift_to 40 }
|
369
|
+
for_symbols("if") { shift_to 3 }
|
370
|
+
for_symbols("print") { shift_to 70 }
|
371
|
+
for_symbols("simple_statement") { shift_to 39 }
|
372
|
+
for_symbols("word_literal") { shift_to 27 }
|
373
|
+
}
|
374
|
+
|
375
|
+
at_state(79) {
|
376
|
+
for_symbols("newline") { reduce_with "function_body_if_else_statement" }
|
377
|
+
}
|
378
|
+
|
379
|
+
at_state(78) {
|
380
|
+
for_symbols("function_name") { shift_to 62 }
|
381
|
+
for_symbols("var_name") { shift_to 66 }
|
382
|
+
for_symbols("return") { shift_to 60 }
|
383
|
+
for_symbols("newline") { shift_to 58 }
|
384
|
+
for_symbols("function_body_statement") { shift_to 69 }
|
385
|
+
for_symbols("while") { shift_to 53 }
|
386
|
+
for_symbols("if") { shift_to 49 }
|
387
|
+
for_symbols("print") { shift_to 70 }
|
388
|
+
for_symbols("end") { shift_to 79 }
|
389
|
+
for_symbols("simple_statement") { shift_to 52 }
|
390
|
+
for_symbols("word_literal") { shift_to 27 }
|
391
|
+
}
|
392
|
+
|
393
|
+
at_state(74) {
|
394
|
+
for_symbols("function_name") { shift_to 62 }
|
395
|
+
for_symbols("var_name") { shift_to 66 }
|
396
|
+
for_symbols("return") { shift_to 60 }
|
397
|
+
for_symbols("else") { shift_to 75 }
|
398
|
+
for_symbols("newline") { shift_to 58 }
|
399
|
+
for_symbols("function_body_statement") { shift_to 69 }
|
400
|
+
for_symbols("while") { shift_to 53 }
|
401
|
+
for_symbols("if") { shift_to 49 }
|
402
|
+
for_symbols("print") { shift_to 70 }
|
403
|
+
for_symbols("simple_statement") { shift_to 52 }
|
404
|
+
for_symbols("end") { shift_to 80 }
|
405
|
+
for_symbols("word_literal") { shift_to 27 }
|
406
|
+
}
|
407
|
+
|
408
|
+
at_state(56) {
|
409
|
+
for_symbols("terms") { shift_to 57 }
|
410
|
+
for_symbols("newline") { shift_to 1 }
|
411
|
+
}
|
412
|
+
|
413
|
+
at_state(58) {
|
414
|
+
for_symbols("word_literal", "end", "def", "print", "else", "_End_", "if", "return", "newline", "while") { reduce_with "multiple_terms" }
|
415
|
+
}
|
416
|
+
|
417
|
+
at_state(31) {
|
418
|
+
for_symbols(",") { shift_to 32 }
|
419
|
+
for_symbols(")") { shift_to 34 }
|
420
|
+
}
|
421
|
+
|
422
|
+
at_state(45) {
|
423
|
+
for_symbols(",", ")") { reduce_with "multiple_arg_declarations" }
|
424
|
+
}
|
425
|
+
|
426
|
+
at_state(4) {
|
427
|
+
for_symbols("(") { shift_to 28 }
|
428
|
+
for_symbols("expression") { shift_to 36 }
|
429
|
+
for_symbols("-") { shift_to 5 }
|
430
|
+
for_symbols("numeric_literal") { shift_to 26 }
|
431
|
+
for_symbols("var_name") { shift_to 8 }
|
432
|
+
for_symbols("function_name") { shift_to 6 }
|
433
|
+
for_symbols("!") { shift_to 4 }
|
434
|
+
for_symbols("word_literal") { shift_to 27 }
|
435
|
+
}
|
436
|
+
|
437
|
+
at_state(40) {
|
438
|
+
for_symbols("word_literal") { shift_to 85 }
|
439
|
+
for_symbols("function_name") { shift_to 41 }
|
440
|
+
}
|
441
|
+
|
442
|
+
at_state(21) {
|
443
|
+
for_symbols("==", "+", ",", "-", "/", "<", "_End_", ">", ")", "newline", "*") { reduce_with "power" }
|
444
|
+
}
|
445
|
+
|
446
|
+
at_state(54) {
|
447
|
+
for_symbols("==") { shift_to 22 }
|
448
|
+
for_symbols(">") { shift_to 10 }
|
449
|
+
for_symbols("/") { shift_to 18 }
|
450
|
+
for_symbols("newline") { shift_to 1 }
|
451
|
+
for_symbols("^") { shift_to 20 }
|
452
|
+
for_symbols("*") { shift_to 24 }
|
453
|
+
for_symbols("-") { shift_to 16 }
|
454
|
+
for_symbols("terms") { shift_to 55 }
|
455
|
+
for_symbols("<") { shift_to 14 }
|
456
|
+
for_symbols("+") { shift_to 12 }
|
457
|
+
}
|
458
|
+
|
459
|
+
at_state(65) {
|
460
|
+
for_symbols("_End_", "newline") { reduce_with "function_call_statement" }
|
461
|
+
}
|
462
|
+
|
463
|
+
at_state(23) {
|
464
|
+
for_symbols(">") { shift_to 10 }
|
465
|
+
for_symbols("/") { shift_to 18 }
|
466
|
+
for_symbols("^") { shift_to 20 }
|
467
|
+
for_symbols(",", "_End_", ")", "newline") { reduce_with "equality_comparison" }
|
468
|
+
for_symbols("*") { shift_to 24 }
|
469
|
+
for_symbols("-") { shift_to 16 }
|
470
|
+
for_symbols("<") { shift_to 14 }
|
471
|
+
for_symbols("+") { shift_to 12 }
|
472
|
+
}
|
473
|
+
|
474
|
+
at_state(44) {
|
475
|
+
for_symbols("word_literal") { shift_to 46 }
|
476
|
+
for_symbols("arg_decl") { shift_to 45 }
|
477
|
+
}
|
478
|
+
|
479
|
+
at_state(27) {
|
480
|
+
for_symbols("==", "+", ",", "-", "/", "<", "_End_", "=", "^", ">", ")", "newline", "*") { reduce_with "variable_name" }
|
481
|
+
for_symbols("(") { reduce_with "function_name" }
|
482
|
+
}
|
483
|
+
|
484
|
+
at_state(102) {
|
485
|
+
for_symbols("_End_") { reduce_with "no_terms" }
|
486
|
+
for_symbols("newline") { shift_to 1 }
|
487
|
+
for_symbols("terms") { shift_to 104 }
|
488
|
+
for_symbols("opt_terms") { shift_to 103 }
|
489
|
+
}
|
490
|
+
|
491
|
+
at_state(84) {
|
492
|
+
for_symbols(",", ")") { reduce_with "single_arg_declaration" }
|
493
|
+
}
|
494
|
+
|
495
|
+
at_state(73) {
|
496
|
+
for_symbols("terms") { shift_to 74 }
|
497
|
+
for_symbols("newline") { shift_to 1 }
|
498
|
+
}
|
499
|
+
|
500
|
+
at_state(71) {
|
501
|
+
for_symbols("==") { shift_to 22 }
|
502
|
+
for_symbols(">") { shift_to 10 }
|
503
|
+
for_symbols("/") { shift_to 18 }
|
504
|
+
for_symbols("^") { shift_to 20 }
|
505
|
+
for_symbols("*") { shift_to 24 }
|
506
|
+
for_symbols("-") { shift_to 16 }
|
507
|
+
for_symbols("<") { shift_to 14 }
|
508
|
+
for_symbols("_End_", "newline") { reduce_with "print_statement" }
|
509
|
+
for_symbols("+") { shift_to 12 }
|
510
|
+
}
|
511
|
+
|
512
|
+
at_state(26) {
|
513
|
+
for_symbols("==", "+", ",", "-", "/", "<", "_End_", "^", ">", ")", "newline", "*") { reduce_with "literal" }
|
514
|
+
}
|
515
|
+
|
516
|
+
at_state(28) {
|
517
|
+
for_symbols("(") { shift_to 28 }
|
518
|
+
for_symbols("-") { shift_to 5 }
|
519
|
+
for_symbols("numeric_literal") { shift_to 26 }
|
520
|
+
for_symbols("var_name") { shift_to 8 }
|
521
|
+
for_symbols("function_name") { shift_to 6 }
|
522
|
+
for_symbols("!") { shift_to 4 }
|
523
|
+
for_symbols("expression") { shift_to 29 }
|
524
|
+
for_symbols("word_literal") { shift_to 27 }
|
525
|
+
}
|
526
|
+
|
527
|
+
at_state(8) {
|
528
|
+
for_symbols("==", "+", ",", "-", "/", "<", "_End_", "^", ">", ")", "newline", "*") { reduce_with "variable_reference" }
|
529
|
+
}
|
530
|
+
|
531
|
+
at_state(33) {
|
532
|
+
for_symbols("==") { shift_to 22 }
|
533
|
+
for_symbols(">") { shift_to 10 }
|
534
|
+
for_symbols("/") { shift_to 18 }
|
535
|
+
for_symbols("^") { shift_to 20 }
|
536
|
+
for_symbols("*") { shift_to 24 }
|
537
|
+
for_symbols("-") { shift_to 16 }
|
538
|
+
for_symbols("<") { shift_to 14 }
|
539
|
+
for_symbols(",", ")") { reduce_with "multiple_args" }
|
540
|
+
for_symbols("+") { shift_to 12 }
|
541
|
+
}
|
542
|
+
|
543
|
+
at_state(13) {
|
544
|
+
for_symbols("/") { shift_to 18 }
|
545
|
+
for_symbols("^") { shift_to 20 }
|
546
|
+
for_symbols("*") { shift_to 24 }
|
547
|
+
for_symbols("==", "+", ",", "-", "<", "_End_", ">", ")", "newline") { reduce_with "addition" }
|
548
|
+
}
|
549
|
+
|
550
|
+
at_state(29) {
|
551
|
+
for_symbols("==") { shift_to 22 }
|
552
|
+
for_symbols(">") { shift_to 10 }
|
553
|
+
for_symbols("/") { shift_to 18 }
|
554
|
+
for_symbols("^") { shift_to 20 }
|
555
|
+
for_symbols("*") { shift_to 24 }
|
556
|
+
for_symbols("-") { shift_to 16 }
|
557
|
+
for_symbols("<") { shift_to 14 }
|
558
|
+
for_symbols(")") { shift_to 30 }
|
559
|
+
for_symbols("+") { shift_to 12 }
|
560
|
+
}
|
561
|
+
|
562
|
+
at_state(35) {
|
563
|
+
for_symbols("^") { shift_to 20 }
|
564
|
+
for_symbols("==", "+", ",", "-", "/", "<", "_End_", ">", ")", "newline", "*") { reduce_with "negated_expression" }
|
565
|
+
}
|
566
|
+
|
567
|
+
at_state(104) {
|
568
|
+
for_symbols("function_name") { shift_to 62 }
|
569
|
+
for_symbols("var_name") { shift_to 66 }
|
570
|
+
for_symbols("while") { shift_to 86 }
|
571
|
+
for_symbols("newline") { shift_to 58 }
|
572
|
+
for_symbols("def") { shift_to 40 }
|
573
|
+
for_symbols("_End_") { reduce_with "some_terms" }
|
574
|
+
for_symbols("main_body_statement") { shift_to 93 }
|
575
|
+
for_symbols("if") { shift_to 3 }
|
576
|
+
for_symbols("print") { shift_to 70 }
|
577
|
+
for_symbols("simple_statement") { shift_to 39 }
|
578
|
+
for_symbols("word_literal") { shift_to 27 }
|
579
|
+
}
|
580
|
+
|
581
|
+
at_state(99) {
|
582
|
+
for_symbols("function_name") { shift_to 62 }
|
583
|
+
for_symbols("var_name") { shift_to 66 }
|
584
|
+
for_symbols("while") { shift_to 86 }
|
585
|
+
for_symbols("newline") { shift_to 58 }
|
586
|
+
for_symbols("def") { shift_to 40 }
|
587
|
+
for_symbols("main_body_statement") { shift_to 93 }
|
588
|
+
for_symbols("if") { shift_to 3 }
|
589
|
+
for_symbols("end") { shift_to 100 }
|
590
|
+
for_symbols("print") { shift_to 70 }
|
591
|
+
for_symbols("simple_statement") { shift_to 39 }
|
592
|
+
for_symbols("word_literal") { shift_to 27 }
|
593
|
+
}
|
594
|
+
|
595
|
+
at_state(92) {
|
596
|
+
for_symbols("_End_", "newline") { reduce_with "main_body_while_statement" }
|
597
|
+
}
|
598
|
+
|
599
|
+
at_state(91) {
|
600
|
+
for_symbols("function_name") { shift_to 62 }
|
601
|
+
for_symbols("var_name") { shift_to 66 }
|
602
|
+
for_symbols("while") { shift_to 86 }
|
603
|
+
for_symbols("newline") { shift_to 58 }
|
604
|
+
for_symbols("def") { shift_to 40 }
|
605
|
+
for_symbols("end") { shift_to 92 }
|
606
|
+
for_symbols("main_body_statement") { shift_to 93 }
|
607
|
+
for_symbols("if") { shift_to 3 }
|
608
|
+
for_symbols("print") { shift_to 70 }
|
609
|
+
for_symbols("simple_statement") { shift_to 39 }
|
610
|
+
for_symbols("word_literal") { shift_to 27 }
|
611
|
+
}
|
612
|
+
|
613
|
+
at_state(68) {
|
614
|
+
for_symbols("==") { shift_to 22 }
|
615
|
+
for_symbols(">") { shift_to 10 }
|
616
|
+
for_symbols("_End_", "newline") { reduce_with "assignment_statement" }
|
617
|
+
for_symbols("/") { shift_to 18 }
|
618
|
+
for_symbols("^") { shift_to 20 }
|
619
|
+
for_symbols("*") { shift_to 24 }
|
620
|
+
for_symbols("-") { shift_to 16 }
|
621
|
+
for_symbols("<") { shift_to 14 }
|
622
|
+
for_symbols("+") { shift_to 12 }
|
623
|
+
}
|
624
|
+
|
625
|
+
at_state(66) {
|
626
|
+
for_symbols("=") { shift_to 67 }
|
627
|
+
}
|
628
|
+
|
629
|
+
at_state(53) {
|
630
|
+
for_symbols("(") { shift_to 28 }
|
631
|
+
for_symbols("expression") { shift_to 54 }
|
632
|
+
for_symbols("-") { shift_to 5 }
|
633
|
+
for_symbols("numeric_literal") { shift_to 26 }
|
634
|
+
for_symbols("var_name") { shift_to 8 }
|
635
|
+
for_symbols("function_name") { shift_to 6 }
|
636
|
+
for_symbols("!") { shift_to 4 }
|
637
|
+
for_symbols("word_literal") { shift_to 27 }
|
638
|
+
}
|
639
|
+
|
640
|
+
at_state(34) {
|
641
|
+
for_symbols("==", "+", ",", "-", "/", "<", "_End_", "^", ">", ")", "newline", "*") { reduce_with "function_call_expression" }
|
642
|
+
}
|
643
|
+
|
644
|
+
at_state(48) {
|
645
|
+
for_symbols("function_body") { shift_to 81 }
|
646
|
+
for_symbols("function_name") { shift_to 62 }
|
647
|
+
for_symbols("var_name") { shift_to 66 }
|
648
|
+
for_symbols("return") { shift_to 60 }
|
649
|
+
for_symbols("newline") { shift_to 58 }
|
650
|
+
for_symbols("while") { shift_to 53 }
|
651
|
+
for_symbols("if") { shift_to 49 }
|
652
|
+
for_symbols("print") { shift_to 70 }
|
653
|
+
for_symbols("simple_statement") { shift_to 52 }
|
654
|
+
for_symbols("word_literal") { shift_to 27 }
|
655
|
+
for_symbols("function_body_statement") { shift_to 72 }
|
656
|
+
}
|
657
|
+
|
658
|
+
at_state(60) {
|
659
|
+
for_symbols("(") { shift_to 28 }
|
660
|
+
for_symbols("expression") { shift_to 61 }
|
661
|
+
for_symbols("-") { shift_to 5 }
|
662
|
+
for_symbols("numeric_literal") { shift_to 26 }
|
663
|
+
for_symbols("var_name") { shift_to 8 }
|
664
|
+
for_symbols("function_name") { shift_to 6 }
|
665
|
+
for_symbols("!") { shift_to 4 }
|
666
|
+
for_symbols("word_literal") { shift_to 27 }
|
667
|
+
}
|
668
|
+
|
669
|
+
at_state(97) {
|
670
|
+
for_symbols("function_name") { shift_to 62 }
|
671
|
+
for_symbols("var_name") { shift_to 66 }
|
672
|
+
for_symbols("main_body_statement") { shift_to 89 }
|
673
|
+
for_symbols("while") { shift_to 86 }
|
674
|
+
for_symbols("newline") { shift_to 58 }
|
675
|
+
for_symbols("main_body") { shift_to 98 }
|
676
|
+
for_symbols("def") { shift_to 40 }
|
677
|
+
for_symbols("if") { shift_to 3 }
|
678
|
+
for_symbols("print") { shift_to 70 }
|
679
|
+
for_symbols("simple_statement") { shift_to 39 }
|
680
|
+
for_symbols("word_literal") { shift_to 27 }
|
681
|
+
}
|
682
|
+
|
683
|
+
at_state(10) {
|
684
|
+
for_symbols("(") { shift_to 28 }
|
685
|
+
for_symbols("-") { shift_to 5 }
|
686
|
+
for_symbols("numeric_literal") { shift_to 26 }
|
687
|
+
for_symbols("var_name") { shift_to 8 }
|
688
|
+
for_symbols("function_name") { shift_to 6 }
|
689
|
+
for_symbols("expression") { shift_to 11 }
|
690
|
+
for_symbols("!") { shift_to 4 }
|
691
|
+
for_symbols("word_literal") { shift_to 27 }
|
692
|
+
}
|
693
|
+
|
694
|
+
at_state(42) {
|
695
|
+
for_symbols(",", ")") { reduce_with "no_arg_decl" }
|
696
|
+
for_symbols("word_literal") { shift_to 46 }
|
697
|
+
for_symbols("arg_decl") { shift_to 84 }
|
698
|
+
for_symbols("arg_declarations") { shift_to 43 }
|
699
|
+
}
|
700
|
+
|
701
|
+
at_state(51) {
|
702
|
+
for_symbols("function_name") { shift_to 62 }
|
703
|
+
for_symbols("var_name") { shift_to 66 }
|
704
|
+
for_symbols("function_body") { shift_to 73 }
|
705
|
+
for_symbols("return") { shift_to 60 }
|
706
|
+
for_symbols("newline") { shift_to 58 }
|
707
|
+
for_symbols("while") { shift_to 53 }
|
708
|
+
for_symbols("if") { shift_to 49 }
|
709
|
+
for_symbols("print") { shift_to 70 }
|
710
|
+
for_symbols("simple_statement") { shift_to 52 }
|
711
|
+
for_symbols("word_literal") { shift_to 27 }
|
712
|
+
for_symbols("function_body_statement") { shift_to 72 }
|
713
|
+
}
|
714
|
+
|
715
|
+
at_state(20) {
|
716
|
+
for_symbols("(") { shift_to 28 }
|
717
|
+
for_symbols("expression") { shift_to 21 }
|
718
|
+
for_symbols("-") { shift_to 5 }
|
719
|
+
for_symbols("numeric_literal") { shift_to 26 }
|
720
|
+
for_symbols("var_name") { shift_to 8 }
|
721
|
+
for_symbols("function_name") { shift_to 6 }
|
722
|
+
for_symbols("!") { shift_to 4 }
|
723
|
+
for_symbols("word_literal") { shift_to 27 }
|
724
|
+
}
|
725
|
+
|
726
|
+
at_state(98) {
|
727
|
+
for_symbols("newline") { shift_to 1 }
|
728
|
+
for_symbols("terms") { shift_to 99 }
|
729
|
+
}
|
730
|
+
|
731
|
+
at_state(96) {
|
732
|
+
for_symbols("newline") { shift_to 1 }
|
733
|
+
for_symbols("terms") { shift_to 97 }
|
734
|
+
}
|
735
|
+
|
736
|
+
at_state(94) {
|
737
|
+
for_symbols("newline") { shift_to 1 }
|
738
|
+
for_symbols("terms") { shift_to 95 }
|
739
|
+
}
|
740
|
+
|
741
|
+
at_state(86) {
|
742
|
+
for_symbols("(") { shift_to 28 }
|
743
|
+
for_symbols("-") { shift_to 5 }
|
744
|
+
for_symbols("numeric_literal") { shift_to 26 }
|
745
|
+
for_symbols("var_name") { shift_to 8 }
|
746
|
+
for_symbols("function_name") { shift_to 6 }
|
747
|
+
for_symbols("!") { shift_to 4 }
|
748
|
+
for_symbols("expression") { shift_to 87 }
|
749
|
+
for_symbols("word_literal") { shift_to 27 }
|
750
|
+
}
|
751
|
+
|
752
|
+
at_state(67) {
|
753
|
+
for_symbols("(") { shift_to 28 }
|
754
|
+
for_symbols("-") { shift_to 5 }
|
755
|
+
for_symbols("numeric_literal") { shift_to 26 }
|
756
|
+
for_symbols("var_name") { shift_to 8 }
|
757
|
+
for_symbols("function_name") { shift_to 6 }
|
758
|
+
for_symbols("!") { shift_to 4 }
|
759
|
+
for_symbols("expression") { shift_to 68 }
|
760
|
+
for_symbols("word_literal") { shift_to 27 }
|
761
|
+
}
|
762
|
+
|
763
|
+
at_state(36) {
|
764
|
+
for_symbols("==", "+", ",", "-", "/", "<", "_End_", "^", ">", ")", "newline", "*") { reduce_with "negation" }
|
765
|
+
}
|
766
|
+
|
767
|
+
at_state(25) {
|
768
|
+
for_symbols("^") { shift_to 20 }
|
769
|
+
for_symbols("==", "+", ",", "-", "/", "<", "_End_", ">", ")", "newline", "*") { reduce_with "multiplication" }
|
770
|
+
}
|
771
|
+
|
772
|
+
at_state(101) {
|
773
|
+
for_symbols("_End_", "newline") { reduce_with "main_body_if_statement" }
|
774
|
+
}
|
775
|
+
|
776
|
+
at_state(1) {
|
777
|
+
for_symbols("word_literal", "end", "def", "print", "else", "_End_", "if", "return", "newline", "while") { reduce_with "single_term" }
|
778
|
+
}
|
779
|
+
|
780
|
+
at_state(41) {
|
781
|
+
for_symbols("(") { shift_to 42 }
|
782
|
+
}
|
783
|
+
|
784
|
+
at_state(57) {
|
785
|
+
for_symbols("function_name") { shift_to 62 }
|
786
|
+
for_symbols("var_name") { shift_to 66 }
|
787
|
+
for_symbols("return") { shift_to 60 }
|
788
|
+
for_symbols("newline") { shift_to 58 }
|
789
|
+
for_symbols("function_body_statement") { shift_to 69 }
|
790
|
+
for_symbols("while") { shift_to 53 }
|
791
|
+
for_symbols("end") { shift_to 59 }
|
792
|
+
for_symbols("if") { shift_to 49 }
|
793
|
+
for_symbols("print") { shift_to 70 }
|
794
|
+
for_symbols("simple_statement") { shift_to 52 }
|
795
|
+
for_symbols("word_literal") { shift_to 27 }
|
796
|
+
}
|
797
|
+
|
798
|
+
at_state(95) {
|
799
|
+
for_symbols("function_name") { shift_to 62 }
|
800
|
+
for_symbols("var_name") { shift_to 66 }
|
801
|
+
for_symbols("while") { shift_to 86 }
|
802
|
+
for_symbols("newline") { shift_to 58 }
|
803
|
+
for_symbols("def") { shift_to 40 }
|
804
|
+
for_symbols("end") { shift_to 101 }
|
805
|
+
for_symbols("main_body_statement") { shift_to 93 }
|
806
|
+
for_symbols("if") { shift_to 3 }
|
807
|
+
for_symbols("else") { shift_to 96 }
|
808
|
+
for_symbols("print") { shift_to 70 }
|
809
|
+
for_symbols("simple_statement") { shift_to 39 }
|
810
|
+
for_symbols("word_literal") { shift_to 27 }
|
811
|
+
}
|
812
|
+
|
813
|
+
at_state(77) {
|
814
|
+
for_symbols("newline") { shift_to 1 }
|
815
|
+
for_symbols("terms") { shift_to 78 }
|
816
|
+
}
|
817
|
+
|
818
|
+
at_state(5) {
|
819
|
+
for_symbols("(") { shift_to 28 }
|
820
|
+
for_symbols("-") { shift_to 5 }
|
821
|
+
for_symbols("numeric_literal") { shift_to 26 }
|
822
|
+
for_symbols("var_name") { shift_to 8 }
|
823
|
+
for_symbols("function_name") { shift_to 6 }
|
824
|
+
for_symbols("expression") { shift_to 35 }
|
825
|
+
for_symbols("!") { shift_to 4 }
|
826
|
+
for_symbols("word_literal") { shift_to 27 }
|
827
|
+
}
|
828
|
+
|
829
|
+
at_state(18) {
|
830
|
+
for_symbols("(") { shift_to 28 }
|
831
|
+
for_symbols("-") { shift_to 5 }
|
832
|
+
for_symbols("numeric_literal") { shift_to 26 }
|
833
|
+
for_symbols("var_name") { shift_to 8 }
|
834
|
+
for_symbols("function_name") { shift_to 6 }
|
835
|
+
for_symbols("!") { shift_to 4 }
|
836
|
+
for_symbols("expression") { shift_to 19 }
|
837
|
+
for_symbols("word_literal") { shift_to 27 }
|
838
|
+
}
|
839
|
+
|
840
|
+
at_state(3) {
|
841
|
+
for_symbols("(") { shift_to 28 }
|
842
|
+
for_symbols("-") { shift_to 5 }
|
843
|
+
for_symbols("numeric_literal") { shift_to 26 }
|
844
|
+
for_symbols("var_name") { shift_to 8 }
|
845
|
+
for_symbols("function_name") { shift_to 6 }
|
846
|
+
for_symbols("!") { shift_to 4 }
|
847
|
+
for_symbols("expression") { shift_to 37 }
|
848
|
+
for_symbols("word_literal") { shift_to 27 }
|
849
|
+
}
|
850
|
+
|
851
|
+
at_state(24) {
|
852
|
+
for_symbols("(") { shift_to 28 }
|
853
|
+
for_symbols("-") { shift_to 5 }
|
854
|
+
for_symbols("numeric_literal") { shift_to 26 }
|
855
|
+
for_symbols("var_name") { shift_to 8 }
|
856
|
+
for_symbols("function_name") { shift_to 6 }
|
857
|
+
for_symbols("!") { shift_to 4 }
|
858
|
+
for_symbols("expression") { shift_to 25 }
|
859
|
+
for_symbols("word_literal") { shift_to 27 }
|
860
|
+
}
|
861
|
+
|
862
|
+
at_state(80) {
|
863
|
+
for_symbols("newline") { reduce_with "function_body_if_statement" }
|
864
|
+
}
|
865
|
+
|
866
|
+
at_state(69) {
|
867
|
+
for_symbols("newline") { reduce_with "multiple_function_body_statements" }
|
868
|
+
}
|
869
|
+
|
870
|
+
at_state(46) {
|
871
|
+
for_symbols(",", ")") { reduce_with "arg_declaration" }
|
872
|
+
}
|
873
|
+
|
874
|
+
at_state(47) {
|
875
|
+
for_symbols("newline") { shift_to 1 }
|
876
|
+
for_symbols("terms") { shift_to 48 }
|
877
|
+
}
|
878
|
+
|
879
|
+
end
|