dagon 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.rspec +1 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +86 -0
- data/Rakefile +40 -0
- data/bin/dagon +44 -0
- data/bin/dspec +35 -0
- data/bin/idg +15 -0
- data/bin/idgr +16 -0
- data/build/parser.rb +1015 -0
- data/build/scanner.rb +686 -0
- data/core/array.rb +64 -0
- data/core/block.rb +38 -0
- data/core/class.rb +91 -0
- data/core/false.rb +38 -0
- data/core/float.rb +93 -0
- data/core/frame.rb +24 -0
- data/core/hash.rb +51 -0
- data/core/integer.rb +98 -0
- data/core/object.rb +50 -0
- data/core/string.rb +57 -0
- data/core/true.rb +37 -0
- data/core/vm.rb +125 -0
- data/core/void.rb +37 -0
- data/dagon.gemspec +19 -0
- data/dagon.vim +45 -0
- data/dagon/ast/array_node.rb +17 -0
- data/dagon/ast/assignment_node.rb +21 -0
- data/dagon/ast/block_node.rb +19 -0
- data/dagon/ast/class_definition_node.rb +24 -0
- data/dagon/ast/constant_ref_node.rb +15 -0
- data/dagon/ast/frame.rb +23 -0
- data/dagon/ast/function_call_node.rb +33 -0
- data/dagon/ast/function_definition_node.rb +15 -0
- data/dagon/ast/function_node.rb +23 -0
- data/dagon/ast/hash_node.rb +16 -0
- data/dagon/ast/if_node.rb +20 -0
- data/dagon/ast/instance_init_node.rb +28 -0
- data/dagon/ast/instance_var_ref_node.rb +21 -0
- data/dagon/ast/literal_node.rb +23 -0
- data/dagon/ast/node.rb +22 -0
- data/dagon/ast/root_node.rb +19 -0
- data/dagon/ast/string_node.rb +16 -0
- data/dagon/ast/unary_function_call_node.rb +17 -0
- data/dagon/ast/var_ref_node.rb +19 -0
- data/dagon/ast/while_node.rb +17 -0
- data/dagon/parser.y +151 -0
- data/dagon/scanner.rl +143 -0
- data/examples/assert.dg +8 -0
- data/examples/assignment.dg +2 -0
- data/examples/block.dg +8 -0
- data/examples/class.dg +6 -0
- data/examples/conditional.dg +3 -0
- data/examples/conditions.dg +6 -0
- data/examples/equality.dg +6 -0
- data/examples/error.dg +1 -0
- data/examples/eval.dg +1 -0
- data/examples/fibonacci.dg +15 -0
- data/examples/greeter.dg +6 -0
- data/examples/input.dg +3 -0
- data/examples/instance_variables.dg +11 -0
- data/examples/iterate.dg +2 -0
- data/examples/method_call.dg +9 -0
- data/examples/method_definition.dg +4 -0
- data/examples/operators.dg +6 -0
- data/examples/output.dg +1 -0
- data/examples/require.dg +1 -0
- data/spec/array_spec.dg +26 -0
- data/spec/assertions.dg +11 -0
- data/spec/boolean_spec.dg +48 -0
- data/spec/dspec.dg +16 -0
- data/spec/float_spec.dg +15 -0
- data/spec/hash_spec.dg +6 -0
- data/spec/number_spec.dg +18 -0
- data/spec/return_spec.dg +12 -0
- data/spec/string_spec.dg +18 -0
- data/spec/void_spec.dg +9 -0
- data/spec/while_spec.dg +7 -0
- metadata +180 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Caleb Thompson and Matt Mongeau
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# The Esoteric Order of Dagon
|
2
|
+
|
3
|
+
This is a language designed and implemented by [Caleb Thompson](/calebthompson) and [Goose Mongeau](/halogenandtoast).
|
4
|
+
|
5
|
+
You can call it Dagon for short.
|
6
|
+
|
7
|
+
|
8
|
+
## Dagon As She is Wrote
|
9
|
+
|
10
|
+
```
|
11
|
+
fibonacci-recursive(n): # fuckin hyphens instead of underscores.
|
12
|
+
if n <= 1, return n #leading conditionals. comma rather than semicolon to separate statements
|
13
|
+
self(n - 1) + self(n - 2)
|
14
|
+
```
|
15
|
+
|
16
|
+
```
|
17
|
+
fibonacci-imperative(n):
|
18
|
+
current: 0
|
19
|
+
next: 1
|
20
|
+
|
21
|
+
n.times
|
22
|
+
temp: next
|
23
|
+
next +: current
|
24
|
+
current: temp
|
25
|
+
|
26
|
+
current
|
27
|
+
```
|
28
|
+
|
29
|
+
### Hello
|
30
|
+
|
31
|
+
```
|
32
|
+
puts "Hello World"
|
33
|
+
```
|
34
|
+
|
35
|
+
Outputs strings "Hello " "World\n" (same result as above):
|
36
|
+
|
37
|
+
```
|
38
|
+
print "Hello "
|
39
|
+
print "World\n"
|
40
|
+
```
|
41
|
+
|
42
|
+
## Syntax
|
43
|
+
|
44
|
+
### Assignment
|
45
|
+
|
46
|
+
```
|
47
|
+
x: 1
|
48
|
+
Integer x: 1 # strongly typed
|
49
|
+
x: "string" # raises error or warning: Invalid type (assigning String to Integer)
|
50
|
+
```
|
51
|
+
|
52
|
+
### Classes
|
53
|
+
|
54
|
+
/^(?:[A-Z][a-z]+)+:$/
|
55
|
+
|
56
|
+
```
|
57
|
+
MyClass:
|
58
|
+
# here lies the definition
|
59
|
+
Plant:
|
60
|
+
# defintion
|
61
|
+
Tree(Plant):
|
62
|
+
# tree stuff
|
63
|
+
|
64
|
+
```
|
65
|
+
|
66
|
+
### Methods
|
67
|
+
|
68
|
+
/^(?:[a-z]+-?)+[^-][\(\)]?:\n $/
|
69
|
+
|
70
|
+
```
|
71
|
+
do-stuff:
|
72
|
+
# definition
|
73
|
+
stuff:
|
74
|
+
# definition
|
75
|
+
print():
|
76
|
+
# definition
|
77
|
+
```
|
78
|
+
|
79
|
+
### Variables
|
80
|
+
|
81
|
+
/^(?:[a-z]+-?)+[^-]: $/
|
82
|
+
|
83
|
+
```
|
84
|
+
name: # value
|
85
|
+
another-name: # value
|
86
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
desc "Build freshly"
|
2
|
+
task default: [:clean, :build]
|
3
|
+
|
4
|
+
namespace :build do
|
5
|
+
desc "Build scanner"
|
6
|
+
task scanner: "build/scanner.rb"
|
7
|
+
|
8
|
+
desc "Build parser"
|
9
|
+
task parser: "build/parser.rb"
|
10
|
+
|
11
|
+
namespace :debug do
|
12
|
+
task :parser do
|
13
|
+
`racc -g -v -O build/parser.output -o build/parser.rb dagon/parser.y`
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "Build scanner and parser"
|
19
|
+
task build: %w{build:scanner build:parser}
|
20
|
+
task debug: %w{build:scanner build:debug:parser}
|
21
|
+
|
22
|
+
desc "Remove generated files"
|
23
|
+
task :clean do
|
24
|
+
if File.exists?('build/')
|
25
|
+
`rm -r build`
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
file "build/parser.rb" => "dagon/parser.y" do
|
30
|
+
`mkdir -p build/`
|
31
|
+
`racc -g -o build/parser.rb dagon/parser.y`
|
32
|
+
end
|
33
|
+
file "build/scanner.rb" => "dagon/scanner.rl" do
|
34
|
+
`mkdir -p build/`
|
35
|
+
`ragel -R dagon/scanner.rl -o build/scanner.rb`
|
36
|
+
end
|
37
|
+
|
38
|
+
task test: :default do
|
39
|
+
puts `rspec`
|
40
|
+
end
|
data/bin/dagon
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..")
|
4
|
+
|
5
|
+
require 'optparse'
|
6
|
+
require './build/scanner'
|
7
|
+
require './build/parser'
|
8
|
+
require 'pp'
|
9
|
+
|
10
|
+
|
11
|
+
options = {}
|
12
|
+
|
13
|
+
OptionParser.new do |opts|
|
14
|
+
opts.on("-t", "--tokens", "Show only tokens") do |v|
|
15
|
+
options[:only_tokens] = v
|
16
|
+
end
|
17
|
+
|
18
|
+
opts.on("-d", "--debug", "Debug") do |v|
|
19
|
+
options[:debug] = v
|
20
|
+
end
|
21
|
+
end.parse!
|
22
|
+
|
23
|
+
program = nil
|
24
|
+
filename = nil
|
25
|
+
|
26
|
+
vm = Dagon::Core::VM.new
|
27
|
+
if ARGV[0]
|
28
|
+
filename = ARGV[0]
|
29
|
+
program = File.read(filename)
|
30
|
+
path = File.dirname(File.join(Dir.getwd, filename))
|
31
|
+
vm.add_load_path path
|
32
|
+
else
|
33
|
+
filename = '(stdin)'
|
34
|
+
program = STDIN.read
|
35
|
+
vm.add_load_path Dir.getwd
|
36
|
+
end
|
37
|
+
|
38
|
+
tokens = Dagon::Scanner.tokenize(program, filename)
|
39
|
+
if options[:only_tokens]
|
40
|
+
pp tokens
|
41
|
+
exit(1)
|
42
|
+
end
|
43
|
+
tree = Dagon::Parser.parse(tokens, filename, options[:debug])
|
44
|
+
tree.evaluate(vm)
|
data/bin/dspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..")
|
4
|
+
|
5
|
+
require './build/scanner'
|
6
|
+
require './build/parser'
|
7
|
+
require 'core/vm'
|
8
|
+
|
9
|
+
def run_tests files
|
10
|
+
vm = Dagon::Core::VM.new
|
11
|
+
program = %{require("spec/dspec")\n}
|
12
|
+
tokens = Dagon::Scanner.tokenize(program, '(dspec)')
|
13
|
+
tree = Dagon::Parser.parse(tokens, '(dspec)', false)
|
14
|
+
tree.evaluate(vm)
|
15
|
+
files.each do |file|
|
16
|
+
path = File.dirname(File.join(Dir.getwd, file))
|
17
|
+
vm.add_load_path path
|
18
|
+
actual_program = program.dup
|
19
|
+
actual_program << File.open(file, 'rb').read
|
20
|
+
actual_program << "\n"
|
21
|
+
tokens = Dagon::Scanner.tokenize(actual_program, file)
|
22
|
+
tree = Dagon::Parser.parse(tokens, file, false)
|
23
|
+
tree.evaluate(vm)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def dspec_files
|
28
|
+
if ARGV.empty?
|
29
|
+
Dir.glob('spec/*_spec.dg')
|
30
|
+
else
|
31
|
+
ARGV
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
run_tests(dspec_files)
|
data/bin/idg
ADDED
data/bin/idgr
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..")
|
4
|
+
|
5
|
+
require 'readline'
|
6
|
+
require './build/scanner'
|
7
|
+
require './build/parser'
|
8
|
+
|
9
|
+
vm = Dagon::Core::VM.new
|
10
|
+
filename = '(stdin)'
|
11
|
+
while line = Readline.readline('idg:> ', true)
|
12
|
+
tokens = Dagon::Scanner.tokenize(line, filename)
|
13
|
+
tree = Dagon::Parser.parse(tokens, line, false)
|
14
|
+
puts "=> #{tree.evaluate(vm).to_s}"
|
15
|
+
end
|
16
|
+
|
data/build/parser.rb
ADDED
@@ -0,0 +1,1015 @@
|
|
1
|
+
#
|
2
|
+
# DO NOT MODIFY!!!!
|
3
|
+
# This file is automatically generated by Racc 1.4.9
|
4
|
+
# from Racc grammer file "".
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'racc/parser.rb'
|
8
|
+
|
9
|
+
%w(
|
10
|
+
node root_node function_call_node function_definition_node function_node
|
11
|
+
string_node literal_node var_ref_node if_node assignment_node while_node
|
12
|
+
class_definition_node instance_init_node block_node hash_node array_node
|
13
|
+
unary_function_call_node constant_ref_node instance_var_ref_node
|
14
|
+
).each { |node| require_relative "../dagon/ast/#{node}" }
|
15
|
+
|
16
|
+
module Dagon
|
17
|
+
class Parser < Racc::Parser
|
18
|
+
|
19
|
+
module_eval(<<'...end parser.y/module_eval...', 'parser.y', 122)
|
20
|
+
|
21
|
+
def initialize(tokens, filename, debug = false)
|
22
|
+
@yydebug = debug
|
23
|
+
@filename = filename
|
24
|
+
@tokens = tokens
|
25
|
+
@line = 0
|
26
|
+
end
|
27
|
+
|
28
|
+
def parse
|
29
|
+
do_parse
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.parse(tokens, filename, debug = false)
|
33
|
+
new(tokens, filename, debug).parse
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
attr_accessor :tokens
|
38
|
+
def next_token
|
39
|
+
tokens.shift
|
40
|
+
end
|
41
|
+
|
42
|
+
def on_error error_token_id, error_value, value_stack
|
43
|
+
$stderr.puts "#{@filename}:#{error_value.line}: syntax error, unexpected #{error_value.data.inspect}", value_stack.inspect
|
44
|
+
exit
|
45
|
+
end
|
46
|
+
|
47
|
+
def call_on_object(object, method, *args)
|
48
|
+
AST::FunctionCallNode.new(@filename, nil, object, method, args, nil)
|
49
|
+
end
|
50
|
+
...end parser.y/module_eval...
|
51
|
+
##### State transition tables begin ###
|
52
|
+
|
53
|
+
racc_action_table = [
|
54
|
+
16, 91, 57, 107, 107, 66, 66, 129, 91, 107,
|
55
|
+
134, 70, 70, 55, 113, 114, 94, 10, 11, 16,
|
56
|
+
137, 12, 132, 14, 19, 91, 107, 20, 106, 21,
|
57
|
+
27, 28, 29, 30, 31, 32, 10, 11, 16, 118,
|
58
|
+
12, 56, 14, 19, 111, 112, 20, 107, 21, 27,
|
59
|
+
28, 29, 30, 31, 32, 10, 11, 16, 142, 12,
|
60
|
+
117, 14, 19, 42, 118, 20, 107, 21, 27, 28,
|
61
|
+
29, 30, 31, 32, 10, 11, 16, 125, 12, 76,
|
62
|
+
14, 19, 104, 105, 20, 91, 21, 27, 28, 29,
|
63
|
+
30, 31, 32, 16, 145, 111, 112, 52, 42, 51,
|
64
|
+
19, 63, 64, 20, -49, 21, 27, 28, 29, 30,
|
65
|
+
31, 32, 16, 42, 52, 42, 51, 19, -49, 93,
|
66
|
+
20, 70, 21, 27, 28, 29, 30, 31, 32, 16,
|
67
|
+
91, 118, -49, 52, 61, 14, 19, 57, 56, 20,
|
68
|
+
58, 21, 27, 28, 29, 30, 31, 32, 16, 70,
|
69
|
+
52, 118, 14, 19, 57, 91, 20, 91, 21, 27,
|
70
|
+
28, 29, 30, 31, 32, 16, 42, -49, 59, 52,
|
71
|
+
101, 51, 19, 94, 118, 20, 91, 21, 27, 28,
|
72
|
+
29, 30, 31, 32, 16, 143, 52, 91, 51, 19,
|
73
|
+
33, 147, 20, nil, 21, 27, 28, 29, 30, 31,
|
74
|
+
32, nil, nil, nil, 16, 52, nil, 51, 19, nil,
|
75
|
+
nil, 20, nil, 21, 27, 28, 29, 30, 31, 32,
|
76
|
+
124, 10, 11, 16, nil, 12, nil, 14, 19, nil,
|
77
|
+
nil, 20, nil, 21, 27, 28, 29, 30, 31, 32,
|
78
|
+
16, nil, nil, nil, 52, nil, 14, 19, nil, nil,
|
79
|
+
20, nil, 21, 27, 28, 29, 30, 31, 32, 16,
|
80
|
+
nil, 52, nil, 14, 19, nil, nil, 20, nil, 21,
|
81
|
+
27, 28, 29, 30, 31, 32, 16, nil, nil, nil,
|
82
|
+
52, nil, 14, 19, nil, nil, 20, nil, 21, 27,
|
83
|
+
28, 29, 30, 31, 32, 16, nil, 52, nil, 51,
|
84
|
+
19, nil, nil, 20, nil, 21, 27, 28, 29, 30,
|
85
|
+
31, 32, 16, nil, nil, nil, 52, nil, 51, 19,
|
86
|
+
nil, nil, 20, nil, 21, 27, 28, 29, 30, 31,
|
87
|
+
32, 16, nil, 52, nil, 14, 19, nil, nil, 20,
|
88
|
+
nil, 21, 27, 28, 29, 30, 31, 32, 16, nil,
|
89
|
+
nil, nil, 52, nil, 51, 19, nil, nil, 20, nil,
|
90
|
+
21, 27, 28, 29, 30, 31, 32, 16, nil, 52,
|
91
|
+
nil, 51, 19, nil, nil, 20, nil, 21, 27, 28,
|
92
|
+
29, 30, 31, 32, 16, nil, nil, nil, 52, nil,
|
93
|
+
51, 19, nil, nil, 20, nil, 21, 27, 28, 29,
|
94
|
+
30, 31, 32, 16, nil, 52, nil, 51, 19, nil,
|
95
|
+
nil, 20, nil, 21, 27, 28, 29, 30, 31, 32,
|
96
|
+
16, nil, nil, nil, 52, nil, 51, 19, nil, nil,
|
97
|
+
20, nil, 21, 27, 28, 29, 30, 31, 32, 16,
|
98
|
+
nil, 52, nil, 51, 19, nil, nil, 20, nil, 21,
|
99
|
+
27, 28, 29, 30, 31, 32, 16, nil, nil, nil,
|
100
|
+
52, nil, 51, 19, nil, nil, 20, nil, 21, 27,
|
101
|
+
28, 29, 30, 31, 32, 16, nil, 52, nil, 51,
|
102
|
+
19, nil, nil, 20, nil, 21, 27, 28, 29, 30,
|
103
|
+
31, 32, 16, nil, nil, nil, 52, nil, 51, 19,
|
104
|
+
nil, nil, 20, nil, 21, 27, 28, 29, 30, 31,
|
105
|
+
32, 16, nil, 52, nil, 51, 19, nil, nil, 20,
|
106
|
+
nil, 21, 27, 28, 29, 30, 31, 32, 16, nil,
|
107
|
+
nil, nil, 52, nil, 51, 19, nil, nil, 20, nil,
|
108
|
+
21, 27, 28, 29, 30, 31, 32, 16, nil, 52,
|
109
|
+
nil, 51, 19, nil, nil, 20, nil, 21, 27, 28,
|
110
|
+
29, 30, 31, 32, nil, nil, 16, nil, 52, nil,
|
111
|
+
14, 19, nil, nil, 20, nil, 21, 27, 28, 29,
|
112
|
+
30, 31, 32, 10, 11, 16, nil, 12, nil, 14,
|
113
|
+
19, nil, nil, 20, nil, 21, 27, 28, 29, 30,
|
114
|
+
31, 32, 16, nil, nil, nil, 52, nil, 51, 19,
|
115
|
+
nil, nil, 20, nil, 21, 27, 28, 29, 30, 31,
|
116
|
+
32, nil, nil, 52, nil, 51, 19, nil, nil, 20,
|
117
|
+
nil, 21, 27, 28, 29, 30, 31, 32, 42, nil,
|
118
|
+
39, 40, 41, 37, 38, 36, 35, nil, 43, 44,
|
119
|
+
46, 45, 47, 48, nil, nil, nil, nil, 42, nil,
|
120
|
+
39, 40, 41, 37, 38, 36, 35, 121, 43, 44,
|
121
|
+
46, 45, 47, 48, 42, nil, 39, 40, 41, 37,
|
122
|
+
38, 36, 35, nil, -78, -78, -78, -78, -78, -78,
|
123
|
+
42, nil, 39, 40, 41, 37, 38, 36, 35, nil,
|
124
|
+
-78, -78, -78, -78, -78, -78, 42, nil, 39, 40,
|
125
|
+
41, 37, 38, 36, 35, nil, 43, 44, 46, 45,
|
126
|
+
47, 48, 42, nil, 39, 40, 41, 37, 38, 36,
|
127
|
+
35, nil, -78, -78, -78, -78, -78, -78, 42, nil,
|
128
|
+
39, 40, 41, 37, 38, 36, 35, nil, 43, 44,
|
129
|
+
46, 45, 47, 48, 42, nil, 39, 40, 41, 37,
|
130
|
+
38, 36, 35, nil, 43, 44, 46, 45, 47, 48,
|
131
|
+
42, nil, 39, 40, 41, 37, 38, 36, 35, nil,
|
132
|
+
-78, -78, -78, -78, -78, -78, 42, nil, 39, 40,
|
133
|
+
41, 37, 38, 36, 35, nil, -78, -78, -78, -78,
|
134
|
+
-78, -78, 42, nil, 39, 40, 41, 37, 38, 36,
|
135
|
+
35, nil, 43, 44, 46, 45, 47, 48, 42, nil,
|
136
|
+
39, 40, 41, 37, 38, 36, 35, nil, -78, -78,
|
137
|
+
-78, -78, -78, -78, 42, nil, 39, 40, 41, 37,
|
138
|
+
38, 42, nil, 39, 40, 41, 37, 38, 42, nil,
|
139
|
+
39, 40, 41, 42, nil, 39, 40, 41 ]
|
140
|
+
|
141
|
+
racc_action_check = [
|
142
|
+
0, 118, 71, 97, 100, 19, 105, 114, 55, 131,
|
143
|
+
118, 19, 105, 12, 97, 100, 71, 0, 0, 145,
|
144
|
+
131, 0, 118, 0, 0, 49, 73, 0, 73, 0,
|
145
|
+
0, 0, 0, 0, 0, 0, 145, 145, 2, 114,
|
146
|
+
145, 12, 145, 145, 95, 95, 145, 138, 145, 145,
|
147
|
+
145, 145, 145, 145, 145, 2, 2, 134, 138, 2,
|
148
|
+
102, 2, 2, 84, 102, 2, 109, 2, 2, 2,
|
149
|
+
2, 2, 2, 2, 134, 134, 10, 109, 134, 33,
|
150
|
+
134, 134, 67, 67, 134, 142, 134, 134, 134, 134,
|
151
|
+
134, 134, 134, 11, 142, 135, 135, 10, 83, 10,
|
152
|
+
10, 18, 18, 10, 21, 10, 10, 10, 10, 10,
|
153
|
+
10, 10, 132, 82, 11, 81, 11, 11, 21, 51,
|
154
|
+
11, 66, 11, 11, 11, 11, 11, 11, 11, 117,
|
155
|
+
112, 113, 21, 132, 14, 132, 132, 65, 52, 132,
|
156
|
+
13, 132, 132, 132, 132, 132, 132, 132, 57, 63,
|
157
|
+
117, 125, 117, 117, 13, 126, 117, 129, 117, 117,
|
158
|
+
117, 117, 117, 117, 117, 16, 62, 61, 13, 57,
|
159
|
+
60, 57, 57, 53, 137, 57, 58, 57, 57, 57,
|
160
|
+
57, 57, 57, 57, 111, 139, 16, 54, 16, 16,
|
161
|
+
1, 146, 16, nil, 16, 16, 16, 16, 16, 16,
|
162
|
+
16, nil, nil, nil, 108, 111, nil, 111, 111, nil,
|
163
|
+
nil, 111, nil, 111, 111, 111, 111, 111, 111, 111,
|
164
|
+
108, 108, 108, 20, nil, 108, nil, 108, 108, nil,
|
165
|
+
nil, 108, nil, 108, 108, 108, 108, 108, 108, 108,
|
166
|
+
107, nil, nil, nil, 20, nil, 20, 20, nil, nil,
|
167
|
+
20, nil, 20, 20, 20, 20, 20, 20, 20, 56,
|
168
|
+
nil, 107, nil, 107, 107, nil, nil, 107, nil, 107,
|
169
|
+
107, 107, 107, 107, 107, 107, 35, nil, nil, nil,
|
170
|
+
56, nil, 56, 56, nil, nil, 56, nil, 56, 56,
|
171
|
+
56, 56, 56, 56, 56, 36, nil, 35, nil, 35,
|
172
|
+
35, nil, nil, 35, nil, 35, 35, 35, 35, 35,
|
173
|
+
35, 35, 59, nil, nil, nil, 36, nil, 36, 36,
|
174
|
+
nil, nil, 36, nil, 36, 36, 36, 36, 36, 36,
|
175
|
+
36, 38, nil, 59, nil, 59, 59, nil, nil, 59,
|
176
|
+
nil, 59, 59, 59, 59, 59, 59, 59, 39, nil,
|
177
|
+
nil, nil, 38, nil, 38, 38, nil, nil, 38, nil,
|
178
|
+
38, 38, 38, 38, 38, 38, 38, 40, nil, 39,
|
179
|
+
nil, 39, 39, nil, nil, 39, nil, 39, 39, 39,
|
180
|
+
39, 39, 39, 39, 41, nil, nil, nil, 40, nil,
|
181
|
+
40, 40, nil, nil, 40, nil, 40, 40, 40, 40,
|
182
|
+
40, 40, 40, 42, nil, 41, nil, 41, 41, nil,
|
183
|
+
nil, 41, nil, 41, 41, 41, 41, 41, 41, 41,
|
184
|
+
43, nil, nil, nil, 42, nil, 42, 42, nil, nil,
|
185
|
+
42, nil, 42, 42, 42, 42, 42, 42, 42, 44,
|
186
|
+
nil, 43, nil, 43, 43, nil, nil, 43, nil, 43,
|
187
|
+
43, 43, 43, 43, 43, 43, 45, nil, nil, nil,
|
188
|
+
44, nil, 44, 44, nil, nil, 44, nil, 44, 44,
|
189
|
+
44, 44, 44, 44, 44, 46, nil, 45, nil, 45,
|
190
|
+
45, nil, nil, 45, nil, 45, 45, 45, 45, 45,
|
191
|
+
45, 45, 47, nil, nil, nil, 46, nil, 46, 46,
|
192
|
+
nil, nil, 46, nil, 46, 46, 46, 46, 46, 46,
|
193
|
+
46, 48, nil, 47, nil, 47, 47, nil, nil, 47,
|
194
|
+
nil, 47, 47, 47, 47, 47, 47, 47, 101, nil,
|
195
|
+
nil, nil, 48, nil, 48, 48, nil, nil, 48, nil,
|
196
|
+
48, 48, 48, 48, 48, 48, 48, 94, nil, 101,
|
197
|
+
nil, 101, 101, nil, nil, 101, nil, 101, 101, 101,
|
198
|
+
101, 101, 101, 101, nil, nil, 91, nil, 94, nil,
|
199
|
+
94, 94, nil, nil, 94, nil, 94, 94, 94, 94,
|
200
|
+
94, 94, 94, 91, 91, 64, nil, 91, nil, 91,
|
201
|
+
91, nil, nil, 91, nil, 91, 91, 91, 91, 91,
|
202
|
+
91, 91, 37, nil, nil, nil, 64, nil, 64, 64,
|
203
|
+
nil, nil, 64, nil, 64, 64, 64, 64, 64, 64,
|
204
|
+
64, nil, nil, 37, nil, 37, 37, nil, nil, 37,
|
205
|
+
nil, 37, 37, 37, 37, 37, 37, 37, 103, nil,
|
206
|
+
103, 103, 103, 103, 103, 103, 103, nil, 103, 103,
|
207
|
+
103, 103, 103, 103, nil, nil, nil, nil, 98, nil,
|
208
|
+
98, 98, 98, 98, 98, 98, 98, 103, 98, 98,
|
209
|
+
98, 98, 98, 98, 88, nil, 88, 88, 88, 88,
|
210
|
+
88, 88, 88, nil, 88, 88, 88, 88, 88, 88,
|
211
|
+
89, nil, 89, 89, 89, 89, 89, 89, 89, nil,
|
212
|
+
89, 89, 89, 89, 89, 89, 7, nil, 7, 7,
|
213
|
+
7, 7, 7, 7, 7, nil, 7, 7, 7, 7,
|
214
|
+
7, 7, 85, nil, 85, 85, 85, 85, 85, 85,
|
215
|
+
85, nil, 85, 85, 85, 85, 85, 85, 115, nil,
|
216
|
+
115, 115, 115, 115, 115, 115, 115, nil, 115, 115,
|
217
|
+
115, 115, 115, 115, 50, nil, 50, 50, 50, 50,
|
218
|
+
50, 50, 50, nil, 50, 50, 50, 50, 50, 50,
|
219
|
+
87, nil, 87, 87, 87, 87, 87, 87, 87, nil,
|
220
|
+
87, 87, 87, 87, 87, 87, 90, nil, 90, 90,
|
221
|
+
90, 90, 90, 90, 90, nil, 90, 90, 90, 90,
|
222
|
+
90, 90, 72, nil, 72, 72, 72, 72, 72, 72,
|
223
|
+
72, nil, 72, 72, 72, 72, 72, 72, 86, nil,
|
224
|
+
86, 86, 86, 86, 86, 86, 86, nil, 86, 86,
|
225
|
+
86, 86, 86, 86, 78, nil, 78, 78, 78, 78,
|
226
|
+
78, 77, nil, 77, 77, 77, 77, 77, 80, nil,
|
227
|
+
80, 80, 80, 79, nil, 79, 79, 79 ]
|
228
|
+
|
229
|
+
racc_action_pointer = [
|
230
|
+
-3, 190, 35, nil, nil, nil, nil, 704, nil, nil,
|
231
|
+
73, 90, 2, 129, 102, nil, 162, nil, 60, -21,
|
232
|
+
220, 93, nil, nil, nil, nil, nil, nil, nil, nil,
|
233
|
+
nil, nil, nil, 79, nil, 273, 292, 599, 328, 345,
|
234
|
+
364, 381, 400, 417, 436, 453, 472, 489, 508, 7,
|
235
|
+
752, 87, 99, 134, 169, -10, 256, 145, 158, 309,
|
236
|
+
145, 142, 164, 117, 582, 112, 89, 54, nil, nil,
|
237
|
+
nil, -23, 800, -3, nil, nil, nil, 839, 832, 851,
|
238
|
+
846, 113, 111, 96, 61, 720, 816, 768, 672, 688,
|
239
|
+
784, 563, nil, nil, 544, 22, nil, -26, 656, nil,
|
240
|
+
-25, 525, 21, 636, nil, -20, nil, 237, 201, 37,
|
241
|
+
nil, 181, 112, 88, -4, 736, nil, 126, -17, nil,
|
242
|
+
nil, nil, nil, nil, nil, 108, 137, nil, nil, 139,
|
243
|
+
nil, -20, 109, nil, 54, 73, nil, 131, 18, 157,
|
244
|
+
nil, nil, 67, nil, nil, 16, 163, nil ]
|
245
|
+
|
246
|
+
racc_action_default = [
|
247
|
+
-1, -78, -2, -5, -6, -7, -8, -9, -10, -11,
|
248
|
+
-78, -78, -52, -78, -78, -28, -78, -36, -37, -39,
|
249
|
+
-44, -51, -53, -54, -55, -56, -57, -58, -59, -60,
|
250
|
+
-61, -62, -63, -78, -4, -78, -78, -78, -78, -78,
|
251
|
+
-78, -78, -78, -78, -78, -78, -78, -78, -78, -28,
|
252
|
+
-78, -78, -52, -78, -28, -78, -44, -78, -78, -44,
|
253
|
+
-78, -50, -29, -78, -78, -78, -78, -78, -40, -42,
|
254
|
+
-49, -78, -47, -78, -45, -48, 148, -20, -21, -22,
|
255
|
+
-23, -24, -25, -26, -27, -30, -31, -32, -33, -34,
|
256
|
+
-35, -78, -12, -50, -44, -14, -17, -78, -18, -64,
|
257
|
+
-78, -78, -75, -78, -38, -78, -43, -78, -78, -78,
|
258
|
+
-13, -78, -78, -75, -75, -19, -66, -44, -78, -76,
|
259
|
+
-77, -69, -41, -46, -3, -75, -28, -16, -70, -78,
|
260
|
+
-68, -78, -44, -72, -78, -14, -65, -75, -78, -78,
|
261
|
+
-15, -67, -78, -74, -71, -78, -78, -73 ]
|
262
|
+
|
263
|
+
racc_goto_table = [
|
264
|
+
7, 2, 7, 68, 6, 67, 6, 34, 123, 1,
|
265
|
+
50, 50, 13, 73, 13, 110, 62, 49, 54, 116,
|
266
|
+
nil, nil, nil, 69, nil, nil, 60, nil, nil, nil,
|
267
|
+
128, 65, 71, nil, nil, 77, 78, 79, 80, 81,
|
268
|
+
82, 83, 84, 85, 86, 87, 88, 89, 90, 97,
|
269
|
+
nil, nil, 100, nil, 141, 140, nil, 98, nil, nil,
|
270
|
+
nil, nil, nil, nil, 103, nil, nil, nil, 71, nil,
|
271
|
+
nil, 71, nil, nil, 92, 102, nil, nil, 60, 95,
|
272
|
+
96, nil, nil, 99, nil, nil, nil, 109, nil, 122,
|
273
|
+
nil, 7, 108, nil, nil, 6, nil, nil, nil, nil,
|
274
|
+
nil, 115, nil, 13, nil, nil, 71, nil, 7, 69,
|
275
|
+
131, 50, 6, 34, nil, nil, nil, 65, 126, 71,
|
276
|
+
13, nil, nil, nil, nil, 138, nil, nil, nil, 71,
|
277
|
+
nil, nil, nil, nil, 7, nil, nil, 127, 6, 139,
|
278
|
+
nil, nil, nil, 133, 71, 7, 13, nil, nil, 6,
|
279
|
+
146, 135, nil, nil, 136, nil, nil, 13, nil, nil,
|
280
|
+
nil, nil, nil, nil, nil, nil, nil, 144 ]
|
281
|
+
|
282
|
+
racc_goto_check = [
|
283
|
+
8, 2, 8, 18, 7, 17, 7, 4, 21, 1,
|
284
|
+
8, 8, 13, 20, 13, 12, 8, 11, 11, 25,
|
285
|
+
nil, nil, nil, 7, nil, nil, 13, nil, nil, nil,
|
286
|
+
25, 13, 13, nil, nil, 8, 8, 8, 8, 8,
|
287
|
+
8, 8, 8, 8, 8, 8, 8, 8, 8, 20,
|
288
|
+
nil, nil, 20, nil, 25, 12, nil, 8, nil, nil,
|
289
|
+
nil, nil, nil, nil, 8, nil, nil, nil, 13, nil,
|
290
|
+
nil, 13, nil, nil, 3, 13, nil, nil, 13, 3,
|
291
|
+
3, nil, nil, 3, nil, nil, nil, 20, nil, 18,
|
292
|
+
nil, 8, 2, nil, nil, 7, nil, nil, nil, nil,
|
293
|
+
nil, 8, nil, 13, nil, nil, 13, nil, 8, 7,
|
294
|
+
20, 8, 7, 4, nil, nil, nil, 13, 11, 13,
|
295
|
+
13, nil, nil, nil, nil, 20, nil, nil, nil, 13,
|
296
|
+
nil, nil, nil, nil, 8, nil, nil, 3, 7, 4,
|
297
|
+
nil, nil, nil, 3, 13, 8, 13, nil, nil, 7,
|
298
|
+
4, 3, nil, nil, 3, nil, nil, 13, nil, nil,
|
299
|
+
nil, nil, nil, nil, nil, nil, nil, 3 ]
|
300
|
+
|
301
|
+
racc_goto_pointer = [
|
302
|
+
nil, 9, 1, 25, 5, nil, nil, 4, 0, nil,
|
303
|
+
nil, 7, -80, 12, nil, nil, nil, -14, -16, nil,
|
304
|
+
-7, -99, nil, nil, nil, -83, nil, nil ]
|
305
|
+
|
306
|
+
racc_goto_default = [
|
307
|
+
nil, nil, nil, nil, 3, 4, 5, 75, 72, 8,
|
308
|
+
9, 15, nil, 53, 17, 18, 24, nil, nil, 23,
|
309
|
+
nil, 74, 22, 25, 26, 130, 119, 120 ]
|
310
|
+
|
311
|
+
racc_reduce_table = [
|
312
|
+
0, 0, :racc_error,
|
313
|
+
0, 45, :_reduce_1,
|
314
|
+
1, 45, :_reduce_2,
|
315
|
+
3, 47, :_reduce_3,
|
316
|
+
2, 46, :_reduce_4,
|
317
|
+
1, 46, :_reduce_5,
|
318
|
+
1, 48, :_reduce_none,
|
319
|
+
1, 48, :_reduce_none,
|
320
|
+
1, 48, :_reduce_none,
|
321
|
+
1, 48, :_reduce_none,
|
322
|
+
1, 48, :_reduce_none,
|
323
|
+
1, 48, :_reduce_none,
|
324
|
+
3, 54, :_reduce_12,
|
325
|
+
4, 53, :_reduce_13,
|
326
|
+
0, 56, :_reduce_14,
|
327
|
+
4, 56, :_reduce_15,
|
328
|
+
2, 56, :_reduce_16,
|
329
|
+
3, 49, :_reduce_17,
|
330
|
+
3, 51, :_reduce_18,
|
331
|
+
4, 51, :_reduce_19,
|
332
|
+
3, 52, :_reduce_20,
|
333
|
+
3, 52, :_reduce_21,
|
334
|
+
3, 52, :_reduce_22,
|
335
|
+
3, 52, :_reduce_23,
|
336
|
+
3, 52, :_reduce_24,
|
337
|
+
3, 52, :_reduce_25,
|
338
|
+
3, 52, :_reduce_26,
|
339
|
+
3, 52, :_reduce_27,
|
340
|
+
1, 52, :_reduce_none,
|
341
|
+
2, 58, :_reduce_29,
|
342
|
+
3, 55, :_reduce_30,
|
343
|
+
3, 55, :_reduce_31,
|
344
|
+
3, 55, :_reduce_32,
|
345
|
+
3, 55, :_reduce_33,
|
346
|
+
3, 55, :_reduce_34,
|
347
|
+
3, 55, :_reduce_35,
|
348
|
+
1, 55, :_reduce_none,
|
349
|
+
1, 55, :_reduce_none,
|
350
|
+
3, 60, :_reduce_38,
|
351
|
+
0, 61, :_reduce_39,
|
352
|
+
1, 61, :_reduce_40,
|
353
|
+
3, 61, :_reduce_41,
|
354
|
+
1, 62, :_reduce_42,
|
355
|
+
3, 63, :_reduce_43,
|
356
|
+
0, 64, :_reduce_44,
|
357
|
+
1, 64, :_reduce_45,
|
358
|
+
3, 64, :_reduce_46,
|
359
|
+
1, 65, :_reduce_47,
|
360
|
+
1, 65, :_reduce_48,
|
361
|
+
1, 57, :_reduce_49,
|
362
|
+
2, 59, :_reduce_50,
|
363
|
+
1, 59, :_reduce_51,
|
364
|
+
1, 59, :_reduce_52,
|
365
|
+
1, 59, :_reduce_none,
|
366
|
+
1, 59, :_reduce_none,
|
367
|
+
1, 59, :_reduce_none,
|
368
|
+
1, 59, :_reduce_none,
|
369
|
+
1, 59, :_reduce_none,
|
370
|
+
1, 66, :_reduce_58,
|
371
|
+
1, 66, :_reduce_59,
|
372
|
+
1, 66, :_reduce_60,
|
373
|
+
1, 66, :_reduce_61,
|
374
|
+
1, 66, :_reduce_62,
|
375
|
+
1, 66, :_reduce_63,
|
376
|
+
3, 50, :_reduce_64,
|
377
|
+
6, 50, :_reduce_65,
|
378
|
+
4, 67, :_reduce_66,
|
379
|
+
7, 67, :_reduce_67,
|
380
|
+
5, 67, :_reduce_68,
|
381
|
+
4, 67, :_reduce_69,
|
382
|
+
5, 68, :_reduce_70,
|
383
|
+
5, 70, :_reduce_71,
|
384
|
+
2, 70, :_reduce_72,
|
385
|
+
7, 71, :_reduce_73,
|
386
|
+
4, 71, :_reduce_74,
|
387
|
+
0, 69, :_reduce_75,
|
388
|
+
1, 69, :_reduce_76,
|
389
|
+
1, 69, :_reduce_77 ]
|
390
|
+
|
391
|
+
racc_reduce_n = 78
|
392
|
+
|
393
|
+
racc_shift_n = 148
|
394
|
+
|
395
|
+
racc_token_table = {
|
396
|
+
false => 0,
|
397
|
+
:error => 1,
|
398
|
+
:EXPONENT => 2,
|
399
|
+
"!" => 3,
|
400
|
+
"&&" => 4,
|
401
|
+
"||" => 5,
|
402
|
+
"^" => 6,
|
403
|
+
"*" => 7,
|
404
|
+
"/" => 8,
|
405
|
+
"+" => 9,
|
406
|
+
"-" => 10,
|
407
|
+
":" => 11,
|
408
|
+
">" => 12,
|
409
|
+
"<" => 13,
|
410
|
+
">=" => 14,
|
411
|
+
"<=" => 15,
|
412
|
+
"=" => 16,
|
413
|
+
"!=" => 17,
|
414
|
+
:INDENT => 18,
|
415
|
+
:DEDENT => 19,
|
416
|
+
:WHILE => 20,
|
417
|
+
:IF => 21,
|
418
|
+
:ELSEIF => 22,
|
419
|
+
:ELSE => 23,
|
420
|
+
:CONSTANT => 24,
|
421
|
+
:ASSIGNMENT => 25,
|
422
|
+
"@" => 26,
|
423
|
+
:LBRACE => 27,
|
424
|
+
:RBRACE => 28,
|
425
|
+
:COMMA => 29,
|
426
|
+
:LBRACKET => 30,
|
427
|
+
:RBRACKET => 31,
|
428
|
+
:IDENTIFIER => 32,
|
429
|
+
:FLOAT => 33,
|
430
|
+
:INTEGER => 34,
|
431
|
+
:STRING => 35,
|
432
|
+
:TRUE => 36,
|
433
|
+
:FALSE => 37,
|
434
|
+
:VOID => 38,
|
435
|
+
:LPAREN => 39,
|
436
|
+
:RPAREN => 40,
|
437
|
+
:DOT => 41,
|
438
|
+
"[" => 42,
|
439
|
+
:ARROW => 43 }
|
440
|
+
|
441
|
+
racc_nt_base = 44
|
442
|
+
|
443
|
+
racc_use_result_var = true
|
444
|
+
|
445
|
+
Racc_arg = [
|
446
|
+
racc_action_table,
|
447
|
+
racc_action_check,
|
448
|
+
racc_action_default,
|
449
|
+
racc_action_pointer,
|
450
|
+
racc_goto_table,
|
451
|
+
racc_goto_check,
|
452
|
+
racc_goto_default,
|
453
|
+
racc_goto_pointer,
|
454
|
+
racc_nt_base,
|
455
|
+
racc_reduce_table,
|
456
|
+
racc_token_table,
|
457
|
+
racc_shift_n,
|
458
|
+
racc_reduce_n,
|
459
|
+
racc_use_result_var ]
|
460
|
+
|
461
|
+
Racc_token_to_s_table = [
|
462
|
+
"$end",
|
463
|
+
"error",
|
464
|
+
"EXPONENT",
|
465
|
+
"\"!\"",
|
466
|
+
"\"&&\"",
|
467
|
+
"\"||\"",
|
468
|
+
"\"^\"",
|
469
|
+
"\"*\"",
|
470
|
+
"\"/\"",
|
471
|
+
"\"+\"",
|
472
|
+
"\"-\"",
|
473
|
+
"\":\"",
|
474
|
+
"\">\"",
|
475
|
+
"\"<\"",
|
476
|
+
"\">=\"",
|
477
|
+
"\"<=\"",
|
478
|
+
"\"=\"",
|
479
|
+
"\"!=\"",
|
480
|
+
"INDENT",
|
481
|
+
"DEDENT",
|
482
|
+
"WHILE",
|
483
|
+
"IF",
|
484
|
+
"ELSEIF",
|
485
|
+
"ELSE",
|
486
|
+
"CONSTANT",
|
487
|
+
"ASSIGNMENT",
|
488
|
+
"\"@\"",
|
489
|
+
"LBRACE",
|
490
|
+
"RBRACE",
|
491
|
+
"COMMA",
|
492
|
+
"LBRACKET",
|
493
|
+
"RBRACKET",
|
494
|
+
"IDENTIFIER",
|
495
|
+
"FLOAT",
|
496
|
+
"INTEGER",
|
497
|
+
"STRING",
|
498
|
+
"TRUE",
|
499
|
+
"FALSE",
|
500
|
+
"VOID",
|
501
|
+
"LPAREN",
|
502
|
+
"RPAREN",
|
503
|
+
"DOT",
|
504
|
+
"\"[\"",
|
505
|
+
"ARROW",
|
506
|
+
"$start",
|
507
|
+
"program",
|
508
|
+
"statements",
|
509
|
+
"block",
|
510
|
+
"statement",
|
511
|
+
"class_definition",
|
512
|
+
"method_definition",
|
513
|
+
"assignment",
|
514
|
+
"expression",
|
515
|
+
"conditional_statement",
|
516
|
+
"while_statement",
|
517
|
+
"condition",
|
518
|
+
"else_stmt",
|
519
|
+
"method_name",
|
520
|
+
"unary_expression",
|
521
|
+
"term",
|
522
|
+
"hash",
|
523
|
+
"hash_list",
|
524
|
+
"hash_member",
|
525
|
+
"array",
|
526
|
+
"list",
|
527
|
+
"list_member",
|
528
|
+
"literal",
|
529
|
+
"method_call",
|
530
|
+
"object_call",
|
531
|
+
"lambda",
|
532
|
+
"multiline_lambda",
|
533
|
+
"singleline_lambda" ]
|
534
|
+
|
535
|
+
Racc_debug_parser = true
|
536
|
+
|
537
|
+
##### State transition tables end #####
|
538
|
+
|
539
|
+
# reduce 0 omitted
|
540
|
+
|
541
|
+
module_eval(<<'.,.,', 'parser.y', 11)
|
542
|
+
def _reduce_1(val, _values, result)
|
543
|
+
result = []
|
544
|
+
result
|
545
|
+
end
|
546
|
+
.,.,
|
547
|
+
|
548
|
+
module_eval(<<'.,.,', 'parser.y', 12)
|
549
|
+
def _reduce_2(val, _values, result)
|
550
|
+
result = AST::RootNode.new(val[0])
|
551
|
+
result
|
552
|
+
end
|
553
|
+
.,.,
|
554
|
+
|
555
|
+
module_eval(<<'.,.,', 'parser.y', 14)
|
556
|
+
def _reduce_3(val, _values, result)
|
557
|
+
result = val[1]
|
558
|
+
result
|
559
|
+
end
|
560
|
+
.,.,
|
561
|
+
|
562
|
+
module_eval(<<'.,.,', 'parser.y', 16)
|
563
|
+
def _reduce_4(val, _values, result)
|
564
|
+
result.push val[1]
|
565
|
+
result
|
566
|
+
end
|
567
|
+
.,.,
|
568
|
+
|
569
|
+
module_eval(<<'.,.,', 'parser.y', 17)
|
570
|
+
def _reduce_5(val, _values, result)
|
571
|
+
result = [val[0]]
|
572
|
+
result
|
573
|
+
end
|
574
|
+
.,.,
|
575
|
+
|
576
|
+
# reduce 6 omitted
|
577
|
+
|
578
|
+
# reduce 7 omitted
|
579
|
+
|
580
|
+
# reduce 8 omitted
|
581
|
+
|
582
|
+
# reduce 9 omitted
|
583
|
+
|
584
|
+
# reduce 10 omitted
|
585
|
+
|
586
|
+
# reduce 11 omitted
|
587
|
+
|
588
|
+
module_eval(<<'.,.,', 'parser.y', 26)
|
589
|
+
def _reduce_12(val, _values, result)
|
590
|
+
result = AST::WhileNode.new(@filename, nil, val[1], val[2])
|
591
|
+
result
|
592
|
+
end
|
593
|
+
.,.,
|
594
|
+
|
595
|
+
module_eval(<<'.,.,', 'parser.y', 28)
|
596
|
+
def _reduce_13(val, _values, result)
|
597
|
+
result = AST::IfNode.new(@filename, nil, val[1], val[2], val[3])
|
598
|
+
result
|
599
|
+
end
|
600
|
+
.,.,
|
601
|
+
|
602
|
+
module_eval(<<'.,.,', 'parser.y', 29)
|
603
|
+
def _reduce_14(val, _values, result)
|
604
|
+
result = nil
|
605
|
+
result
|
606
|
+
end
|
607
|
+
.,.,
|
608
|
+
|
609
|
+
module_eval(<<'.,.,', 'parser.y', 30)
|
610
|
+
def _reduce_15(val, _values, result)
|
611
|
+
result = [AST::IfNode.new(@filename, nil, val[1], val[2], val[3])]
|
612
|
+
result
|
613
|
+
end
|
614
|
+
.,.,
|
615
|
+
|
616
|
+
module_eval(<<'.,.,', 'parser.y', 31)
|
617
|
+
def _reduce_16(val, _values, result)
|
618
|
+
result = val[1]
|
619
|
+
result
|
620
|
+
end
|
621
|
+
.,.,
|
622
|
+
|
623
|
+
module_eval(<<'.,.,', 'parser.y', 33)
|
624
|
+
def _reduce_17(val, _values, result)
|
625
|
+
result = AST::ClassDefinitionNode.new(@filename, nil, val[0].data, val[2])
|
626
|
+
result
|
627
|
+
end
|
628
|
+
.,.,
|
629
|
+
|
630
|
+
module_eval(<<'.,.,', 'parser.y', 36)
|
631
|
+
def _reduce_18(val, _values, result)
|
632
|
+
result = AST::AssignmentNode.new(@filename, nil, val[0].variable_name, val[2])
|
633
|
+
result
|
634
|
+
end
|
635
|
+
.,.,
|
636
|
+
|
637
|
+
module_eval(<<'.,.,', 'parser.y', 37)
|
638
|
+
def _reduce_19(val, _values, result)
|
639
|
+
result = AST::AssignmentNode.new(@filename, nil, "@#{val[1].variable_name}", val[3])
|
640
|
+
result
|
641
|
+
end
|
642
|
+
.,.,
|
643
|
+
|
644
|
+
module_eval(<<'.,.,', 'parser.y', 39)
|
645
|
+
def _reduce_20(val, _values, result)
|
646
|
+
result = call_on_object(val[0], '-', val[2])
|
647
|
+
result
|
648
|
+
end
|
649
|
+
.,.,
|
650
|
+
|
651
|
+
module_eval(<<'.,.,', 'parser.y', 40)
|
652
|
+
def _reduce_21(val, _values, result)
|
653
|
+
result = call_on_object(val[0], '+', val[2])
|
654
|
+
result
|
655
|
+
end
|
656
|
+
.,.,
|
657
|
+
|
658
|
+
module_eval(<<'.,.,', 'parser.y', 41)
|
659
|
+
def _reduce_22(val, _values, result)
|
660
|
+
result = call_on_object(val[0], '*', val[2])
|
661
|
+
result
|
662
|
+
end
|
663
|
+
.,.,
|
664
|
+
|
665
|
+
module_eval(<<'.,.,', 'parser.y', 42)
|
666
|
+
def _reduce_23(val, _values, result)
|
667
|
+
result = call_on_object(val[0], '/', val[2])
|
668
|
+
result
|
669
|
+
end
|
670
|
+
.,.,
|
671
|
+
|
672
|
+
module_eval(<<'.,.,', 'parser.y', 43)
|
673
|
+
def _reduce_24(val, _values, result)
|
674
|
+
result = call_on_object(val[0], '&&', val[2])
|
675
|
+
result
|
676
|
+
end
|
677
|
+
.,.,
|
678
|
+
|
679
|
+
module_eval(<<'.,.,', 'parser.y', 44)
|
680
|
+
def _reduce_25(val, _values, result)
|
681
|
+
result = call_on_object(val[0], '||', val[2])
|
682
|
+
result
|
683
|
+
end
|
684
|
+
.,.,
|
685
|
+
|
686
|
+
module_eval(<<'.,.,', 'parser.y', 45)
|
687
|
+
def _reduce_26(val, _values, result)
|
688
|
+
result = call_on_object(val[0], '^', val[2])
|
689
|
+
result
|
690
|
+
end
|
691
|
+
.,.,
|
692
|
+
|
693
|
+
module_eval(<<'.,.,', 'parser.y', 46)
|
694
|
+
def _reduce_27(val, _values, result)
|
695
|
+
result = call_on_object(val[0], '**', val[2])
|
696
|
+
result
|
697
|
+
end
|
698
|
+
.,.,
|
699
|
+
|
700
|
+
# reduce 28 omitted
|
701
|
+
|
702
|
+
module_eval(<<'.,.,', 'parser.y', 49)
|
703
|
+
def _reduce_29(val, _values, result)
|
704
|
+
result = AST::UnaryFunctionCallNode.new(@filename, nil, val[1], "!")
|
705
|
+
result
|
706
|
+
end
|
707
|
+
.,.,
|
708
|
+
|
709
|
+
module_eval(<<'.,.,', 'parser.y', 51)
|
710
|
+
def _reduce_30(val, _values, result)
|
711
|
+
result = call_on_object(val[0], '>', val[2])
|
712
|
+
result
|
713
|
+
end
|
714
|
+
.,.,
|
715
|
+
|
716
|
+
module_eval(<<'.,.,', 'parser.y', 52)
|
717
|
+
def _reduce_31(val, _values, result)
|
718
|
+
result = call_on_object(val[0], '<', val[2])
|
719
|
+
result
|
720
|
+
end
|
721
|
+
.,.,
|
722
|
+
|
723
|
+
module_eval(<<'.,.,', 'parser.y', 53)
|
724
|
+
def _reduce_32(val, _values, result)
|
725
|
+
result = call_on_object(val[0], '<=', val[2])
|
726
|
+
result
|
727
|
+
end
|
728
|
+
.,.,
|
729
|
+
|
730
|
+
module_eval(<<'.,.,', 'parser.y', 54)
|
731
|
+
def _reduce_33(val, _values, result)
|
732
|
+
result = call_on_object(val[0], '>=', val[2])
|
733
|
+
result
|
734
|
+
end
|
735
|
+
.,.,
|
736
|
+
|
737
|
+
module_eval(<<'.,.,', 'parser.y', 55)
|
738
|
+
def _reduce_34(val, _values, result)
|
739
|
+
result = call_on_object(val[0], '=', val[2])
|
740
|
+
result
|
741
|
+
end
|
742
|
+
.,.,
|
743
|
+
|
744
|
+
module_eval(<<'.,.,', 'parser.y', 56)
|
745
|
+
def _reduce_35(val, _values, result)
|
746
|
+
result = call_on_object(val[0], '!=', val[2])
|
747
|
+
result
|
748
|
+
end
|
749
|
+
.,.,
|
750
|
+
|
751
|
+
# reduce 36 omitted
|
752
|
+
|
753
|
+
# reduce 37 omitted
|
754
|
+
|
755
|
+
module_eval(<<'.,.,', 'parser.y', 60)
|
756
|
+
def _reduce_38(val, _values, result)
|
757
|
+
result = AST::HashNode.new(@filename, nil, val[1])
|
758
|
+
result
|
759
|
+
end
|
760
|
+
.,.,
|
761
|
+
|
762
|
+
module_eval(<<'.,.,', 'parser.y', 61)
|
763
|
+
def _reduce_39(val, _values, result)
|
764
|
+
result = []
|
765
|
+
result
|
766
|
+
end
|
767
|
+
.,.,
|
768
|
+
|
769
|
+
module_eval(<<'.,.,', 'parser.y', 62)
|
770
|
+
def _reduce_40(val, _values, result)
|
771
|
+
result = val
|
772
|
+
result
|
773
|
+
end
|
774
|
+
.,.,
|
775
|
+
|
776
|
+
module_eval(<<'.,.,', 'parser.y', 63)
|
777
|
+
def _reduce_41(val, _values, result)
|
778
|
+
result << val
|
779
|
+
result
|
780
|
+
end
|
781
|
+
.,.,
|
782
|
+
|
783
|
+
module_eval(<<'.,.,', 'parser.y', 64)
|
784
|
+
def _reduce_42(val, _values, result)
|
785
|
+
result = val[0]
|
786
|
+
result
|
787
|
+
end
|
788
|
+
.,.,
|
789
|
+
|
790
|
+
module_eval(<<'.,.,', 'parser.y', 66)
|
791
|
+
def _reduce_43(val, _values, result)
|
792
|
+
result = AST::ArrayNode.new(@filename, nil, val[1])
|
793
|
+
result
|
794
|
+
end
|
795
|
+
.,.,
|
796
|
+
|
797
|
+
module_eval(<<'.,.,', 'parser.y', 67)
|
798
|
+
def _reduce_44(val, _values, result)
|
799
|
+
result = []
|
800
|
+
result
|
801
|
+
end
|
802
|
+
.,.,
|
803
|
+
|
804
|
+
module_eval(<<'.,.,', 'parser.y', 68)
|
805
|
+
def _reduce_45(val, _values, result)
|
806
|
+
result = val
|
807
|
+
result
|
808
|
+
end
|
809
|
+
.,.,
|
810
|
+
|
811
|
+
module_eval(<<'.,.,', 'parser.y', 69)
|
812
|
+
def _reduce_46(val, _values, result)
|
813
|
+
result.push val[2]
|
814
|
+
result
|
815
|
+
end
|
816
|
+
.,.,
|
817
|
+
|
818
|
+
module_eval(<<'.,.,', 'parser.y', 70)
|
819
|
+
def _reduce_47(val, _values, result)
|
820
|
+
result = val[0]
|
821
|
+
result
|
822
|
+
end
|
823
|
+
.,.,
|
824
|
+
|
825
|
+
module_eval(<<'.,.,', 'parser.y', 71)
|
826
|
+
def _reduce_48(val, _values, result)
|
827
|
+
result = val[0]
|
828
|
+
result
|
829
|
+
end
|
830
|
+
.,.,
|
831
|
+
|
832
|
+
module_eval(<<'.,.,', 'parser.y', 74)
|
833
|
+
def _reduce_49(val, _values, result)
|
834
|
+
result = AST::VarRefNode.new(@filename, nil, val[0].data)
|
835
|
+
result
|
836
|
+
end
|
837
|
+
.,.,
|
838
|
+
|
839
|
+
module_eval(<<'.,.,', 'parser.y', 76)
|
840
|
+
def _reduce_50(val, _values, result)
|
841
|
+
result = AST::InstanceVarRefNode.new(@filename, nil, "@#{val[1].data}")
|
842
|
+
result
|
843
|
+
end
|
844
|
+
.,.,
|
845
|
+
|
846
|
+
module_eval(<<'.,.,', 'parser.y', 77)
|
847
|
+
def _reduce_51(val, _values, result)
|
848
|
+
result = AST::VarRefNode.new(@filename, nil, val[0].data)
|
849
|
+
result
|
850
|
+
end
|
851
|
+
.,.,
|
852
|
+
|
853
|
+
module_eval(<<'.,.,', 'parser.y', 78)
|
854
|
+
def _reduce_52(val, _values, result)
|
855
|
+
result = AST::ConstantRefNode.new(@filename, nil, val[0].data)
|
856
|
+
result
|
857
|
+
end
|
858
|
+
.,.,
|
859
|
+
|
860
|
+
# reduce 53 omitted
|
861
|
+
|
862
|
+
# reduce 54 omitted
|
863
|
+
|
864
|
+
# reduce 55 omitted
|
865
|
+
|
866
|
+
# reduce 56 omitted
|
867
|
+
|
868
|
+
# reduce 57 omitted
|
869
|
+
|
870
|
+
module_eval(<<'.,.,', 'parser.y', 85)
|
871
|
+
def _reduce_58(val, _values, result)
|
872
|
+
result = AST::LiteralNode.new(@filename, nil, val[0].data.to_f)
|
873
|
+
result
|
874
|
+
end
|
875
|
+
.,.,
|
876
|
+
|
877
|
+
module_eval(<<'.,.,', 'parser.y', 86)
|
878
|
+
def _reduce_59(val, _values, result)
|
879
|
+
result = AST::LiteralNode.new(@filename, nil, val[0].data.to_i)
|
880
|
+
result
|
881
|
+
end
|
882
|
+
.,.,
|
883
|
+
|
884
|
+
module_eval(<<'.,.,', 'parser.y', 87)
|
885
|
+
def _reduce_60(val, _values, result)
|
886
|
+
result = AST::StringNode.new(@filename, nil, val[0].data)
|
887
|
+
result
|
888
|
+
end
|
889
|
+
.,.,
|
890
|
+
|
891
|
+
module_eval(<<'.,.,', 'parser.y', 88)
|
892
|
+
def _reduce_61(val, _values, result)
|
893
|
+
result = AST::LiteralNode.new(@filename, nil, true)
|
894
|
+
result
|
895
|
+
end
|
896
|
+
.,.,
|
897
|
+
|
898
|
+
module_eval(<<'.,.,', 'parser.y', 89)
|
899
|
+
def _reduce_62(val, _values, result)
|
900
|
+
result = AST::LiteralNode.new(@filename, nil, false)
|
901
|
+
result
|
902
|
+
end
|
903
|
+
.,.,
|
904
|
+
|
905
|
+
module_eval(<<'.,.,', 'parser.y', 90)
|
906
|
+
def _reduce_63(val, _values, result)
|
907
|
+
result = AST::LiteralNode.new(@filename, nil, nil)
|
908
|
+
result
|
909
|
+
end
|
910
|
+
.,.,
|
911
|
+
|
912
|
+
module_eval(<<'.,.,', 'parser.y', 93)
|
913
|
+
def _reduce_64(val, _values, result)
|
914
|
+
result = AST::FunctionDefinitionNode.new(@filename, nil, val[0].variable_name, AST::Function.new(@filename, nil, [], val[2]))
|
915
|
+
result
|
916
|
+
end
|
917
|
+
.,.,
|
918
|
+
|
919
|
+
module_eval(<<'.,.,', 'parser.y', 94)
|
920
|
+
def _reduce_65(val, _values, result)
|
921
|
+
result = AST::FunctionDefinitionNode.new(@filename, nil, val[0].variable_name, AST::Function.new(@filename, nil, val[2], val[5]))
|
922
|
+
result
|
923
|
+
end
|
924
|
+
.,.,
|
925
|
+
|
926
|
+
module_eval(<<'.,.,', 'parser.y', 96)
|
927
|
+
def _reduce_66(val, _values, result)
|
928
|
+
result = AST::FunctionCallNode.new(@filename, nil, val[0], val[2].variable_name, [], val[3])
|
929
|
+
result
|
930
|
+
end
|
931
|
+
.,.,
|
932
|
+
|
933
|
+
module_eval(<<'.,.,', 'parser.y', 97)
|
934
|
+
def _reduce_67(val, _values, result)
|
935
|
+
result = AST::FunctionCallNode.new(@filename, nil, val[0], val[2].variable_name, val[4], val[6])
|
936
|
+
result
|
937
|
+
end
|
938
|
+
.,.,
|
939
|
+
|
940
|
+
module_eval(<<'.,.,', 'parser.y', 98)
|
941
|
+
def _reduce_68(val, _values, result)
|
942
|
+
result = AST::FunctionCallNode.new(@filename, nil, nil, val[0].variable_name, val[2], val[4])
|
943
|
+
result
|
944
|
+
end
|
945
|
+
.,.,
|
946
|
+
|
947
|
+
module_eval(<<'.,.,', 'parser.y', 99)
|
948
|
+
def _reduce_69(val, _values, result)
|
949
|
+
result = AST::FunctionCallNode.new(@filename, nil, val[0], '[]', [val[2]], nil)
|
950
|
+
result
|
951
|
+
end
|
952
|
+
.,.,
|
953
|
+
|
954
|
+
module_eval(<<'.,.,', 'parser.y', 101)
|
955
|
+
def _reduce_70(val, _values, result)
|
956
|
+
result = AST::InstanceInitNode.new(@filename, nil, val[0].data, val[2], val[4])
|
957
|
+
result
|
958
|
+
end
|
959
|
+
.,.,
|
960
|
+
|
961
|
+
module_eval(<<'.,.,', 'parser.y', 103)
|
962
|
+
def _reduce_71(val, _values, result)
|
963
|
+
result = AST::BlockNode.new(@filename, nil, val[4], val[2])
|
964
|
+
result
|
965
|
+
end
|
966
|
+
.,.,
|
967
|
+
|
968
|
+
module_eval(<<'.,.,', 'parser.y', 104)
|
969
|
+
def _reduce_72(val, _values, result)
|
970
|
+
result = AST::BlockNode.new(@filename, nil, val[1], [])
|
971
|
+
result
|
972
|
+
end
|
973
|
+
.,.,
|
974
|
+
|
975
|
+
module_eval(<<'.,.,', 'parser.y', 106)
|
976
|
+
def _reduce_73(val, _values, result)
|
977
|
+
result = AST::BlockNode.new(@filename, nil, [val[5]], val[2])
|
978
|
+
result
|
979
|
+
end
|
980
|
+
.,.,
|
981
|
+
|
982
|
+
module_eval(<<'.,.,', 'parser.y', 107)
|
983
|
+
def _reduce_74(val, _values, result)
|
984
|
+
result = AST::BlockNode.new(@filename, nil, [val[2]], [])
|
985
|
+
result
|
986
|
+
end
|
987
|
+
.,.,
|
988
|
+
|
989
|
+
module_eval(<<'.,.,', 'parser.y', 108)
|
990
|
+
def _reduce_75(val, _values, result)
|
991
|
+
result = nil
|
992
|
+
result
|
993
|
+
end
|
994
|
+
.,.,
|
995
|
+
|
996
|
+
module_eval(<<'.,.,', 'parser.y', 109)
|
997
|
+
def _reduce_76(val, _values, result)
|
998
|
+
result = val[0]
|
999
|
+
result
|
1000
|
+
end
|
1001
|
+
.,.,
|
1002
|
+
|
1003
|
+
module_eval(<<'.,.,', 'parser.y', 110)
|
1004
|
+
def _reduce_77(val, _values, result)
|
1005
|
+
result = val[0]
|
1006
|
+
result
|
1007
|
+
end
|
1008
|
+
.,.,
|
1009
|
+
|
1010
|
+
def _reduce_none(val, _values, result)
|
1011
|
+
val[0]
|
1012
|
+
end
|
1013
|
+
|
1014
|
+
end # class Parser
|
1015
|
+
end # module Dagon
|