dhaka 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/lib/dhaka.rb +44 -0
  2. data/lib/evaluator/evaluator.rb +70 -0
  3. data/lib/grammar/closure_hash.rb +13 -0
  4. data/lib/grammar/grammar.rb +129 -0
  5. data/lib/grammar/grammar_symbol.rb +19 -0
  6. data/lib/grammar/production.rb +14 -0
  7. data/lib/parser/action.rb +51 -0
  8. data/lib/parser/channel.rb +51 -0
  9. data/lib/parser/compiled_parser.rb +35 -0
  10. data/lib/parser/item.rb +37 -0
  11. data/lib/parser/parse_result.rb +26 -0
  12. data/lib/parser/parse_tree.rb +34 -0
  13. data/lib/parser/parser.rb +125 -0
  14. data/lib/parser/parser_methods.rb +10 -0
  15. data/lib/parser/parser_run.rb +35 -0
  16. data/lib/parser/parser_state.rb +66 -0
  17. data/lib/parser/token.rb +15 -0
  18. data/lib/tokenizer/tokenizer.rb +88 -0
  19. data/test/all_tests.rb +11 -0
  20. data/test/arithmetic_evaluator.rb +70 -0
  21. data/test/arithmetic_evaluator_test.rb +55 -0
  22. data/test/arithmetic_grammar.rb +38 -0
  23. data/test/arithmetic_grammar_test.rb +11 -0
  24. data/test/arithmetic_test_methods.rb +11 -0
  25. data/test/arithmetic_tokenizer.rb +43 -0
  26. data/test/arithmetic_tokenizer_test.rb +32 -0
  27. data/test/bracket_grammar.rb +25 -0
  28. data/test/bracket_tokenizer.rb +17 -0
  29. data/test/brackets_test.rb +20 -0
  30. data/test/compiled_arithmetic_parser.rb +252 -0
  31. data/test/compiled_parser_test.rb +71 -0
  32. data/test/evaluator_test.rb +8 -0
  33. data/test/grammar_test.rb +70 -0
  34. data/test/incomplete_arithmetic_evaluator.rb +60 -0
  35. data/test/lalr_but_not_slr_grammar.rb +17 -0
  36. data/test/malformed_grammar.rb +9 -0
  37. data/test/malformed_grammar_test.rb +9 -0
  38. data/test/nullable_grammar.rb +18 -0
  39. data/test/parser_test.rb +168 -0
  40. data/test/rr_conflict_grammar.rb +23 -0
  41. data/test/simple_grammar.rb +24 -0
  42. data/test/sr_conflict_grammar.rb +16 -0
  43. metadata +87 -0
@@ -0,0 +1,55 @@
1
+ require 'test/unit'
2
+ require 'compiled_arithmetic_parser'
3
+ require 'arithmetic_evaluator'
4
+ require 'arithmetic_test_methods'
5
+
6
+ class TestArithmeticEvaluator < Test::Unit::TestCase
7
+ include ArithmeticTestMethods
8
+
9
+ def setup
10
+ @min_func = Proc.new {|args| args.inject {|min, elem| min = (elem < min ? elem : min)}}
11
+ @max_func = Proc.new {|args| args.inject {|max, elem| max = (elem > max ? elem : max)}}
12
+ end
13
+
14
+
15
+ def test_results_simple_arithmetic_given_tokens_and_syntax_tree_1
16
+
17
+ token_stream = [token('n', 2), token('-', nil), token('n', 4), token('#', nil)]
18
+ syntax_tree = get_syntax_tree_with_compiled_arithmetic_parser(token_stream)
19
+ assert_equal -2, ArithmeticEvaluator.new(syntax_tree, @min_func, @max_func).result
20
+
21
+ end
22
+
23
+ def test_results_simple_arithmetic_given_tokens_and_syntax_tree_2
24
+
25
+ token_stream = [token('n', 2), token('-', nil), token('(', nil), token('n', 3), token('/', nil), token('n', 4), token(')', nil), token('#', nil)]
26
+ syntax_tree = get_syntax_tree_with_compiled_arithmetic_parser(token_stream)
27
+ assert_equal 1.25, ArithmeticEvaluator.new(syntax_tree, @min_func, @max_func).result
28
+
29
+ end
30
+
31
+ def test_results_simple_arithmetic_given_tokens_and_syntax_tree_3
32
+
33
+ token_stream = [token('n', 2), token('+', nil), token('(', nil), token('n', 3), token('/', nil), token('(', nil), token('n', 7), token('-', nil), token('n', 5), token(')', nil) , token(')', nil), token('#', nil)]
34
+ syntax_tree = get_syntax_tree_with_compiled_arithmetic_parser(token_stream)
35
+ assert_equal 3.5, ArithmeticEvaluator.new(syntax_tree, @min_func, @max_func).result
36
+
37
+ end
38
+
39
+ def test_results_simple_arithmetic_given_tokens_and_syntax_tree_4
40
+
41
+ token_stream = [token('n', 2), token('+', nil), token('h', nil), token('(', nil), token('n', 3), token(',', nil), token('n', 4), token(')', nil), token('#', nil)]
42
+ syntax_tree = get_syntax_tree_with_compiled_arithmetic_parser(token_stream)
43
+ assert_equal 6, ArithmeticEvaluator.new(syntax_tree, @min_func, @max_func).result
44
+
45
+ end
46
+
47
+ def test_results_simple_arithmetic_given_tokens_and_syntax_tree_5
48
+
49
+ token_stream = [token('n', 2), token('+', nil), token('l', nil), token('(', nil), token('n', 3), token(',', nil), token('n', 4), token(')', nil), token('#', nil)]
50
+ syntax_tree = get_syntax_tree_with_compiled_arithmetic_parser(token_stream)
51
+ assert_equal 5, ArithmeticEvaluator.new(syntax_tree, @min_func, @max_func).result
52
+
53
+ end
54
+
55
+ end
@@ -0,0 +1,38 @@
1
+ require File.dirname(__FILE__)+'/../lib/dhaka'
2
+
3
+ class ArithmeticGrammar < Dhaka::Grammar
4
+ for_symbol(Dhaka::START_SYMBOL_NAME) do
5
+ start_production ['S', '#']
6
+ end
7
+ for_symbol('S') do
8
+ expression ['E']
9
+ end
10
+ for_symbol('E') do
11
+ subtraction ['E', '-', 'T']
12
+ addition ['E', '+', 'T']
13
+ term ['T']
14
+ end
15
+ for_symbol('T') do
16
+ factor ['F']
17
+ division ['T', '/', 'F']
18
+ multiplication ['T', '*', 'F']
19
+ end
20
+ for_symbol('F') do
21
+ getting_literals ['n']
22
+ unpacking_parenthetized_expression ['(', 'E', ')']
23
+ function ['Function']
24
+ end
25
+ for_symbol('Function') do
26
+ evaluating_function ['FunctionName', '(', 'Args', ')']
27
+ end
28
+ for_symbol('FunctionName') do
29
+ max_function ['h']
30
+ min_function ['l']
31
+ end
32
+ for_symbol('Args') do
33
+ empty_args []
34
+ single_args ['E']
35
+ concatenating_args ['E', ',', 'Args']
36
+ end
37
+ end
38
+
@@ -0,0 +1,11 @@
1
+ require 'test/unit'
2
+ require 'arithmetic_grammar'
3
+
4
+ class ArithmeticGrammarTest < Test::Unit::TestCase
5
+
6
+ def test_first_with_nullable_non_terminals
7
+ grammar = ArithmeticGrammar
8
+ assert_equal(Set.new(['(', 'n', 'h', 'l']), Set.new(grammar.first(grammar.symbol_for_name('Args')).collect { |symbol| symbol.name }))
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ module ArithmeticTestMethods
2
+
3
+ def get_syntax_tree_with_compiled_arithmetic_parser(token_stream)
4
+ CompiledArithmeticParser.parse(token_stream).syntax_tree
5
+ end
6
+
7
+ def token(symbol_name, value)
8
+ Dhaka::Token.new(CompiledArithmeticParser.grammar.symbol_for_name(symbol_name), value)
9
+ end
10
+
11
+ end
@@ -0,0 +1,43 @@
1
+ require File.dirname(__FILE__)+'/../lib/dhaka'
2
+ require 'arithmetic_grammar'
3
+
4
+
5
+ class ArithmeticTokenizer < Dhaka::Tokenizer
6
+
7
+ digits = ('0'..'9').to_a
8
+ parenths = ['(', ')']
9
+ operators = ['-', '+', '/', '*']
10
+ functions = ['h', 'l']
11
+ arg_separator = [',']
12
+ sentinel = ['#']
13
+ whitespace = [' ']
14
+
15
+ all_characters = digits + parenths + operators + functions + arg_separator + sentinel + whitespace
16
+
17
+ for_state :idle_state do
18
+ for_characters(all_characters - (digits + whitespace)) do
19
+ tokens << Dhaka::Token.new(ArithmeticGrammar.symbol_for_name(curr_char), nil)
20
+ advance
21
+ end
22
+ for_characters digits do
23
+ self.accumulator = ''
24
+ switch_to :get_integer_literal
25
+ end
26
+ for_character whitespace do
27
+ advance
28
+ end
29
+ end
30
+
31
+ for_state :get_integer_literal do
32
+ for_characters all_characters - digits do
33
+ tokens << Dhaka::Token.new(ArithmeticGrammar.symbol_for_name('n'), accumulator.to_i)
34
+ switch_to :idle_state
35
+ end
36
+ for_characters digits do
37
+ self.accumulator += curr_char
38
+ advance
39
+ end
40
+ end
41
+
42
+ end
43
+
@@ -0,0 +1,32 @@
1
+ require "test/unit"
2
+ require "arithmetic_tokenizer"
3
+
4
+ class TestArithmeticTokenizer < Test::Unit::TestCase
5
+ def test_returns_empty_array_for_empty_input
6
+ assert_equal([], ArithmeticTokenizer.tokenize([]))
7
+ end
8
+ def test_tokenizes_given_a_string_input
9
+ assert_equal([token('n', 2), token('-', nil), token('n', 4), token('#', nil)], ArithmeticTokenizer.tokenize('2 - 4 #'))
10
+ end
11
+ def test_a_longer_input
12
+ actual = ArithmeticTokenizer.tokenize('2+(3 / (7 - 5))#')
13
+ assert_equal([token('n', 2), token('+', nil), token('(', nil), token('n', 3), token('/', nil), token('(', nil), token('n', 7), token('-', nil), token('n', 5), token(')', nil) , token(')', nil), token('#', nil)], actual)
14
+ end
15
+
16
+ def test_another_input_with_multi_digit_numbers
17
+ actual = ArithmeticTokenizer.tokenize('2034 +(3433 / (7 - 5))#')
18
+ assert_equal([token('n', 2034), token('+', nil), token('(', nil), token('n', 3433), token('/', nil), token('(', nil), token('n', 7), token('-', nil), token('n', 5), token(')', nil) , token(')', nil), token('#', nil)], actual)
19
+ end
20
+
21
+ def test_an_input_with_unrecognized_characters
22
+ assert_raise(Dhaka::UnrecognizedInputCharacterException) {ArithmeticTokenizer.tokenize('2+(3 / (7 -& 5))#')}
23
+ end
24
+
25
+ def test_another_input_with_illegal_characters
26
+ assert_raise(Dhaka::UnrecognizedInputCharacterException) {ArithmeticTokenizer.tokenize('2034 +(34b3 / (7 - 5))#')}
27
+ end
28
+
29
+ def token(symbol_name, value)
30
+ Dhaka::Token.new(ArithmeticGrammar.symbol_for_name(symbol_name), value)
31
+ end
32
+ end
@@ -0,0 +1,25 @@
1
+ require File.dirname(__FILE__)+'/../lib/dhaka'
2
+
3
+ class BracketGrammar < Dhaka::Grammar
4
+
5
+ for_symbol(Dhaka::START_SYMBOL_NAME) do
6
+ start ['Package']
7
+ end
8
+
9
+ for_symbol('Package') do
10
+ soft_wrapped_package ['(', 'Contents', ')']
11
+ cardboard_package ['[', 'Contents', ']']
12
+ wooden_package ['{', 'Contents', '}']
13
+ end
14
+
15
+ for_symbol('Contents') do
16
+ bracket ['B']
17
+ set_of_packages ['SetOfPackages']
18
+ end
19
+
20
+ for_symbol('SetOfPackages') do
21
+ one_package ['Package']
22
+ multiple_packages ['SetOfPackages', 'Package']
23
+ end
24
+
25
+ end
@@ -0,0 +1,17 @@
1
+ require File.dirname(__FILE__)+'/../lib/dhaka'
2
+ require 'bracket_grammar'
3
+
4
+
5
+ class BracketTokenizer < Dhaka::Tokenizer
6
+
7
+ all_characters = ['(', '[', '{', 'B', '}', ']', ')']
8
+
9
+ for_state :idle_state do
10
+ for_characters(all_characters) do
11
+ tokens << Dhaka::Token.new(BracketGrammar.symbol_for_name(curr_char), nil)
12
+ advance
13
+ end
14
+ end
15
+
16
+ end
17
+
@@ -0,0 +1,20 @@
1
+ require "test/unit"
2
+
3
+ require "bracket_grammar"
4
+ require 'bracket_tokenizer'
5
+
6
+ class TestBracketGrammar < Test::Unit::TestCase
7
+ def test_recognizes_faulty_bracket_configuration_correctly
8
+ eval Dhaka::Parser.new(BracketGrammar).compile_to_ruby_source_as(:BracketParser)
9
+ assert correct("[{(B)[B]}(B)]")
10
+ assert correct("[[B]{(B)}(B)]")
11
+ assert correct("{(B)[B]}")
12
+ assert !correct("{B[B]}")
13
+ assert !correct("B")
14
+ assert !correct("[[B]{(B)}}(B)]")
15
+ end
16
+ def correct input_string
17
+ result = BracketParser.parse(BracketTokenizer.tokenize(input_string))
18
+ !result.has_error?
19
+ end
20
+ end
@@ -0,0 +1,252 @@
1
+ require File.dirname(__FILE__)+'/../lib/dhaka'
2
+ require 'arithmetic_grammar'
3
+
4
+ class CompiledArithmeticParser < Dhaka::CompiledParser
5
+
6
+ self.grammar = ArithmeticGrammar
7
+
8
+ start_with 33
9
+
10
+ at_state(48) {
11
+ for_symbol('l') { shift_to 47 }
12
+ for_symbol('n') { shift_to 42 }
13
+ for_symbol('FunctionName') { shift_to 34 }
14
+ for_symbol('Function') { shift_to 46 }
15
+ for_symbol('F') { shift_to 49 }
16
+ for_symbol('h') { shift_to 41 }
17
+ for_symbol('(') { shift_to 38 }
18
+ }
19
+
20
+ at_state(43) {
21
+ for_symbol('+') { reduce_with 'subtraction' }
22
+ for_symbol(',') { reduce_with 'subtraction' }
23
+ for_symbol('-') { reduce_with 'subtraction' }
24
+ for_symbol('#') { reduce_with 'subtraction' }
25
+ for_symbol('/') { shift_to 44 }
26
+ for_symbol(')') { reduce_with 'subtraction' }
27
+ for_symbol('*') { shift_to 48 }
28
+ }
29
+
30
+ at_state(55) {
31
+ for_symbol('+') { shift_to 52 }
32
+ for_symbol(',') { shift_to 56 }
33
+ for_symbol('-') { shift_to 40 }
34
+ for_symbol(')') { reduce_with 'single_args' }
35
+ }
36
+
37
+ at_state(53) {
38
+ for_symbol('+') { reduce_with 'addition' }
39
+ for_symbol(',') { reduce_with 'addition' }
40
+ for_symbol('-') { reduce_with 'addition' }
41
+ for_symbol('#') { reduce_with 'addition' }
42
+ for_symbol('/') { shift_to 44 }
43
+ for_symbol(')') { reduce_with 'addition' }
44
+ for_symbol('*') { shift_to 48 }
45
+ }
46
+
47
+ at_state(50) {
48
+ for_symbol('+') { reduce_with 'factor' }
49
+ for_symbol(',') { reduce_with 'factor' }
50
+ for_symbol('-') { reduce_with 'factor' }
51
+ for_symbol('#') { reduce_with 'factor' }
52
+ for_symbol('/') { reduce_with 'factor' }
53
+ for_symbol(')') { reduce_with 'factor' }
54
+ for_symbol('*') { reduce_with 'factor' }
55
+ }
56
+
57
+ at_state(47) {
58
+ for_symbol('(') { reduce_with 'min_function' }
59
+ }
60
+
61
+ at_state(52) {
62
+ for_symbol('l') { shift_to 47 }
63
+ for_symbol('n') { shift_to 42 }
64
+ for_symbol('FunctionName') { shift_to 34 }
65
+ for_symbol('Function') { shift_to 46 }
66
+ for_symbol('F') { shift_to 50 }
67
+ for_symbol('h') { shift_to 41 }
68
+ for_symbol('(') { shift_to 38 }
69
+ for_symbol('T') { shift_to 53 }
70
+ }
71
+
72
+ at_state(33) {
73
+ for_symbol('l') { shift_to 47 }
74
+ for_symbol('n') { shift_to 42 }
75
+ for_symbol('FunctionName') { shift_to 34 }
76
+ for_symbol('E') { shift_to 58 }
77
+ for_symbol('Function') { shift_to 46 }
78
+ for_symbol('F') { shift_to 50 }
79
+ for_symbol('S') { shift_to 59 }
80
+ for_symbol('h') { shift_to 41 }
81
+ for_symbol('(') { shift_to 38 }
82
+ for_symbol('T') { shift_to 54 }
83
+ }
84
+
85
+ at_state(59) {
86
+ for_symbol('#') { shift_to 60 }
87
+ }
88
+
89
+ at_state(38) {
90
+ for_symbol('l') { shift_to 47 }
91
+ for_symbol('n') { shift_to 42 }
92
+ for_symbol('FunctionName') { shift_to 34 }
93
+ for_symbol('E') { shift_to 39 }
94
+ for_symbol('Function') { shift_to 46 }
95
+ for_symbol('F') { shift_to 50 }
96
+ for_symbol('h') { shift_to 41 }
97
+ for_symbol('(') { shift_to 38 }
98
+ for_symbol('T') { shift_to 54 }
99
+ }
100
+
101
+ at_state(34) {
102
+ for_symbol('(') { shift_to 35 }
103
+ }
104
+
105
+ at_state(41) {
106
+ for_symbol('(') { reduce_with 'max_function' }
107
+ }
108
+
109
+ at_state(60) {
110
+ for_symbol('_End_') { reduce_with 'start_production' }
111
+ }
112
+
113
+ at_state(46) {
114
+ for_symbol('+') { reduce_with 'function' }
115
+ for_symbol(',') { reduce_with 'function' }
116
+ for_symbol('-') { reduce_with 'function' }
117
+ for_symbol('#') { reduce_with 'function' }
118
+ for_symbol('/') { reduce_with 'function' }
119
+ for_symbol(')') { reduce_with 'function' }
120
+ for_symbol('*') { reduce_with 'function' }
121
+ }
122
+
123
+ at_state(45) {
124
+ for_symbol('+') { reduce_with 'division' }
125
+ for_symbol(',') { reduce_with 'division' }
126
+ for_symbol('-') { reduce_with 'division' }
127
+ for_symbol('#') { reduce_with 'division' }
128
+ for_symbol('/') { reduce_with 'division' }
129
+ for_symbol(')') { reduce_with 'division' }
130
+ for_symbol('*') { reduce_with 'division' }
131
+ }
132
+
133
+ at_state(35) {
134
+ for_symbol('l') { shift_to 47 }
135
+ for_symbol('n') { shift_to 42 }
136
+ for_symbol('FunctionName') { shift_to 34 }
137
+ for_symbol('E') { shift_to 55 }
138
+ for_symbol('Function') { shift_to 46 }
139
+ for_symbol('F') { shift_to 50 }
140
+ for_symbol('Args') { shift_to 36 }
141
+ for_symbol('h') { shift_to 41 }
142
+ for_symbol('(') { shift_to 38 }
143
+ for_symbol(')') { reduce_with 'empty_args' }
144
+ for_symbol('T') { shift_to 54 }
145
+ }
146
+
147
+ at_state(54) {
148
+ for_symbol('+') { reduce_with 'term' }
149
+ for_symbol(',') { reduce_with 'term' }
150
+ for_symbol('-') { reduce_with 'term' }
151
+ for_symbol('#') { reduce_with 'term' }
152
+ for_symbol('/') { shift_to 44 }
153
+ for_symbol(')') { reduce_with 'term' }
154
+ for_symbol('*') { shift_to 48 }
155
+ }
156
+
157
+ at_state(58) {
158
+ for_symbol('+') { shift_to 52 }
159
+ for_symbol('-') { shift_to 40 }
160
+ for_symbol('#') { reduce_with 'expression' }
161
+ }
162
+
163
+ at_state(56) {
164
+ for_symbol('l') { shift_to 47 }
165
+ for_symbol('n') { shift_to 42 }
166
+ for_symbol('FunctionName') { shift_to 34 }
167
+ for_symbol('E') { shift_to 55 }
168
+ for_symbol('Function') { shift_to 46 }
169
+ for_symbol('F') { shift_to 50 }
170
+ for_symbol('Args') { shift_to 57 }
171
+ for_symbol('h') { shift_to 41 }
172
+ for_symbol('(') { shift_to 38 }
173
+ for_symbol(')') { reduce_with 'empty_args' }
174
+ for_symbol('T') { shift_to 54 }
175
+ }
176
+
177
+ at_state(51) {
178
+ for_symbol('+') { reduce_with 'unpacking_parenthetized_expression' }
179
+ for_symbol(',') { reduce_with 'unpacking_parenthetized_expression' }
180
+ for_symbol('-') { reduce_with 'unpacking_parenthetized_expression' }
181
+ for_symbol('#') { reduce_with 'unpacking_parenthetized_expression' }
182
+ for_symbol('/') { reduce_with 'unpacking_parenthetized_expression' }
183
+ for_symbol(')') { reduce_with 'unpacking_parenthetized_expression' }
184
+ for_symbol('*') { reduce_with 'unpacking_parenthetized_expression' }
185
+ }
186
+
187
+ at_state(44) {
188
+ for_symbol('l') { shift_to 47 }
189
+ for_symbol('n') { shift_to 42 }
190
+ for_symbol('FunctionName') { shift_to 34 }
191
+ for_symbol('F') { shift_to 45 }
192
+ for_symbol('Function') { shift_to 46 }
193
+ for_symbol('h') { shift_to 41 }
194
+ for_symbol('(') { shift_to 38 }
195
+ }
196
+
197
+ at_state(42) {
198
+ for_symbol('+') { reduce_with 'getting_literals' }
199
+ for_symbol(',') { reduce_with 'getting_literals' }
200
+ for_symbol('-') { reduce_with 'getting_literals' }
201
+ for_symbol('#') { reduce_with 'getting_literals' }
202
+ for_symbol('/') { reduce_with 'getting_literals' }
203
+ for_symbol(')') { reduce_with 'getting_literals' }
204
+ for_symbol('*') { reduce_with 'getting_literals' }
205
+ }
206
+
207
+ at_state(36) {
208
+ for_symbol(')') { shift_to 37 }
209
+ }
210
+
211
+ at_state(49) {
212
+ for_symbol('+') { reduce_with 'multiplication' }
213
+ for_symbol(',') { reduce_with 'multiplication' }
214
+ for_symbol('-') { reduce_with 'multiplication' }
215
+ for_symbol('#') { reduce_with 'multiplication' }
216
+ for_symbol('/') { reduce_with 'multiplication' }
217
+ for_symbol(')') { reduce_with 'multiplication' }
218
+ for_symbol('*') { reduce_with 'multiplication' }
219
+ }
220
+
221
+ at_state(57) {
222
+ for_symbol(')') { reduce_with 'concatenating_args' }
223
+ }
224
+
225
+ at_state(40) {
226
+ for_symbol('l') { shift_to 47 }
227
+ for_symbol('n') { shift_to 42 }
228
+ for_symbol('FunctionName') { shift_to 34 }
229
+ for_symbol('Function') { shift_to 46 }
230
+ for_symbol('F') { shift_to 50 }
231
+ for_symbol('h') { shift_to 41 }
232
+ for_symbol('(') { shift_to 38 }
233
+ for_symbol('T') { shift_to 43 }
234
+ }
235
+
236
+ at_state(39) {
237
+ for_symbol('+') { shift_to 52 }
238
+ for_symbol('-') { shift_to 40 }
239
+ for_symbol(')') { shift_to 51 }
240
+ }
241
+
242
+ at_state(37) {
243
+ for_symbol('+') { reduce_with 'evaluating_function' }
244
+ for_symbol(',') { reduce_with 'evaluating_function' }
245
+ for_symbol('-') { reduce_with 'evaluating_function' }
246
+ for_symbol('#') { reduce_with 'evaluating_function' }
247
+ for_symbol('/') { reduce_with 'evaluating_function' }
248
+ for_symbol(')') { reduce_with 'evaluating_function' }
249
+ for_symbol('*') { reduce_with 'evaluating_function' }
250
+ }
251
+
252
+ end