turmali 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9933a3719549c259b1563d70bbd652554aae16d9
4
- data.tar.gz: 317bbc633bc618b4b249119a045f51fd7b3ce12d
3
+ metadata.gz: 50dd915336d790bddf699cd67b7797adfe1bba8c
4
+ data.tar.gz: cee91a42f507574fade6bed46169ac6989ce7d8e
5
5
  SHA512:
6
- metadata.gz: 291ff83a3a34dc538dfadf989a34b678941a331ceb17e1c00779ac951af724511b9e8ed5bc17dc5568ad1df42ca1cbcdea84824719b364e9a306f67440d352cc
7
- data.tar.gz: 56449014334e5e508cdd717c4a64f8076711e3e8491ebb0c3c9ff11c97e8b7653f1b0d8fa1ce45a82558047a9f6108eabc4733b9df2e4662edc28bf203c1de62
6
+ metadata.gz: ad708d750e12f349a327f455bfc556063b7c8956ca397d7737c57e3f27a9eb792fb761b788064c912cdb668b5ed7b2cd696bc8c62da3b15c863fb82dd3a138ce
7
+ data.tar.gz: 3157d41c7af42ad24c94fad99c840449f9250b6a6a37bbb054a03e656eed85a9a5f7ae2389b627947f95c63347ff2b060d47854235263c3afbc1e9de7fa6658a
data/README.md CHANGED
@@ -2,32 +2,52 @@
2
2
 
3
3
  ![Turmali Logo](turmali.png "Turmali Logo")
4
4
 
5
- Turmali is a website building language.
5
+ ## Turmali is a website building language.
6
6
 
7
7
  ▪ As in Python, blocks of code are delimited by their indentation.
8
8
  ▪ Classes are declared with the class keyword.
9
9
  ▪ Methods can be defined anywhere using the def keyword.
10
10
  ▪ Identifiers starting with a capital letter are constants which are globally accessible.
11
11
  ▪ Lower-case identifiers are local variables or method names.
12
- ▪ If a method has a receiver and no argument, parenthesis can be skipped, much like in Ruby. Eg.: self.print is the same as self.print().
12
+ ▪ If a method has a receiver and no argument, parenthesis can be skipped.
13
13
  ▪ The last value evaluated in a method is its return value.
14
14
  ▪ Everything is an object.
15
15
 
16
16
  ## Example
17
17
 
18
- ```
18
+ ```example.tml
19
19
  class Turmali:
20
20
  def name:
21
- "I'm Turmali"
22
- def turmali:
23
- 100
24
-
21
+ "hello eiffel"
22
+ def method:
23
+ a = 5
24
+ if a > 3.0:
25
+ a = 3.4
26
+ b = 5.7
27
+ c = a + b
28
+ c
25
29
 
26
30
  tml = Turmali.new
27
- print(tml.name)
28
- print(tml.turmali)
31
+ print(tml.name)
32
+ print(tml.method)
29
33
  ```
30
34
 
35
+ ## Requirement
36
+
37
+ ### windows
38
+
39
+ https://rubyinstaller.org/
40
+
41
+ ### mac osx
42
+
43
+ Since now all Mac OSX system preinstalled ruby enviroment, that's not a big issue.
44
+
45
+ recommend install ruby through:
46
+
47
+ 1: rbenv https://github.com/rbenv/rbenv
48
+
49
+ 2: rvm http://www.rvm.io/
50
+
31
51
  ## Installation
32
52
 
33
53
  Add this line to your application's Gemfile:
@@ -43,11 +63,13 @@ And then execute:
43
63
  Or install it yourself as:
44
64
 
45
65
  $ gem install turmali
66
+ or
67
+ $ sudo gem install turmali # require admin role
46
68
 
47
69
  ## Usage
48
70
 
49
- $ tml example.tml
50
- $ tml # on Windows run with: ruby -I. tml [options]
71
+ $ tml example.tml # turmali interpreter mode
72
+ $ tml # turmali repl console mode
51
73
 
52
74
  ## License
53
75
 
@@ -155,6 +155,7 @@ rule
155
155
  | Expression '-' Expression { result = CallNode.new(val[0], val[1], [val[2]]) }
156
156
  | Expression '*' Expression { result = CallNode.new(val[0], val[1], [val[2]]) }
157
157
  | Expression '/' Expression { result = CallNode.new(val[0], val[1], [val[2]]) }
158
+ | '!' Expression { result = CallNode.new(val[1], val[0], []) }
158
159
  ;
159
160
 
160
161
  # Then we have rules for getting and setting values of constants and local variables.
data/lib/turmali/lexer.rb CHANGED
@@ -25,8 +25,8 @@ class Lexer
25
25
  tokens << [:CONSTANT, constant]
26
26
  i += constant.size
27
27
 
28
- elsif number = chunk[/\A([0-9]+)/, 1]
29
- tokens << [:NUMBER, number.to_i]
28
+ elsif number = chunk[/\A(\d+(\.\d+)?)/, 1]
29
+ tokens << [:NUMBER, number.to_f]
30
30
  i += number.size
31
31
 
32
32
  elsif string = chunk[/\A"([^"]*)"/, 1]
@@ -57,21 +57,16 @@ class Lexer
57
57
  raise "Missing ':'"
58
58
  end
59
59
  i += indent.size + 1
60
-
61
60
  elsif operator = chunk[/\A(\|\||&&|==|!=|<=|>=)/, 1]
62
61
  tokens << [operator, operator]
63
62
  i += operator.size
64
-
65
63
  elsif chunk.match(/\A /)
66
64
  i += 1
67
-
68
65
  else
69
66
  value = chunk[0,1]
70
67
  tokens << [value, value]
71
68
  i += 1
72
-
73
69
  end
74
-
75
70
  end
76
71
 
77
72
  while indent = indent_stack.pop
data/lib/turmali/nodes.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class Nodes < Struct.new(:nodes)
2
- def <<(node) # Useful method for adding a node on the fly.
2
+ def <<(node)
3
3
  nodes << node
4
4
  self
5
5
  end
@@ -11,7 +11,7 @@ require 'racc/parser.rb'
11
11
 
12
12
  class Parser < Racc::Parser
13
13
 
14
- module_eval(<<'...end grammar.y/module_eval...', 'grammar.y', 220)
14
+ module_eval(<<'...end grammar.y/module_eval...', 'grammar.y', 227)
15
15
  def parse(code, show_tokens=false)
16
16
  @tokens = Lexer.new.tokenize(code) # Tokenize the code using our lexer
17
17
  puts @tokens.inspect if show_tokens
@@ -25,214 +25,245 @@ module_eval(<<'...end grammar.y/module_eval...', 'grammar.y', 220)
25
25
  ##### State transition tables begin ###
26
26
 
27
27
  racc_action_table = [
28
- 27, 25, 26, 16, 18, 19, 20, 21, 22, 23,
29
- 24, 27, 25, 26, 16, 18, 19, 20, 21, 22,
30
- 23, 24, 30, 72, 41, 42, 39, 40, 88, 15,
31
- 30, 17, 41, 42, 39, 40, 30, 16, 41, 42,
32
- 15, 74, 17, 27, 25, 26, 51, 18, 19, 20,
33
- 21, 22, 23, 24, 27, 25, 26, 49, 18, 19,
34
- 20, 21, 22, 23, 24, 17, 16, 30, 48, 41,
35
- 42, 47, 15, 68, 30, 84, 41, 42, 39, 40,
36
- 27, 25, 26, 15, 18, 19, 20, 21, 22, 23,
37
- 24, 27, 25, 26, 17, 18, 19, 20, 21, 22,
38
- 23, 24, 46, 79, 45, 78, 27, 25, 26, 15,
39
- 18, 19, 20, 21, 22, 23, 24, 27, 25, 26,
40
- 15, 18, 19, 20, 21, 22, 23, 24, 86, 72,
41
- 85, 45, 27, 25, 26, 15, 18, 19, 20, 21,
42
- 22, 23, 24, 27, 25, 26, 15, 18, 19, 20,
43
- 21, 22, 23, 24, 30, 30, 82, 28, 27, 25,
44
- 26, 15, 18, 19, 20, 21, 22, 23, 24, 27,
45
- 25, 26, 15, 18, 19, 20, 21, 22, 23, 24,
46
- 72, 53, nil, nil, 27, 25, 26, 15, 18, 19,
47
- 20, 21, 22, 23, 24, 27, 25, 26, 15, 18,
48
- 19, 20, 21, 22, 23, 24, nil, nil, nil, nil,
49
- 27, 25, 26, 15, 18, 19, 20, 21, 22, 23,
50
- 24, 27, 25, 26, 15, 18, 19, 20, 21, 22,
51
- 23, 24, nil, nil, nil, nil, 27, 25, 26, 15,
52
- 18, 19, 20, 21, 22, 23, 24, 27, 25, 26,
53
- 15, 18, 19, 20, 21, 22, 23, 24, nil, nil,
54
- nil, nil, 27, 25, 26, 15, 18, 19, 20, 21,
55
- 22, 23, 24, 27, 25, 26, 15, 18, 19, 20,
56
- 21, 22, 23, 24, nil, nil, nil, nil, 27, 25,
57
- 26, 15, 18, 19, 20, 21, 22, 23, 24, nil,
58
- nil, 30, 15, 41, 42, 39, 40, 35, 36, 37,
59
- 38, 33, 34, 32, 31, nil, nil, 15, 66, 72,
60
- nil, 30, nil, 41, 42, 39, 40, 35, 36, 37,
61
- 38, 33, 34, 32, 31, 30, nil, 41, 42, 39,
62
- 40, 35, 36, 37, 38, 33, 34, 32, 31, 30,
63
- nil, 41, 42, 39, 40, 35, 36, 37, 38, 33,
64
- 34, 32, 31, 30, nil, 41, 42, 39, 40, 35,
65
- 36, 37, 38, 33, 34, 32, 31, 30, nil, 41,
66
- 42, 39, 40, 35, 36, 37, 38, 33, 34, 32,
67
- 31, 30, nil, 41, 42, 39, 40, 35, 36, 37,
68
- 38, 33, 34, 32, 31, 30, nil, 41, 42, 39,
69
- 40, 35, 36, 37, 38, 33, 34, 32, 31, 30,
70
- nil, 41, 42, 39, 40, 35, 36, 37, 38, 33,
71
- 34, 32, 30, nil, 41, 42, 39, 40, 35, 36,
72
- 37, 38, 33, 34, 30, nil, 41, 42, 39, 40,
73
- 35, 36, 37, 38, 30, nil, 41, 42, 39, 40,
74
- 35, 36, 37, 38, 30, nil, 41, 42, 39, 40 ]
28
+ 29, 27, 28, 17, 19, 20, 21, 22, 23, 24,
29
+ 26, 33, 33, 30, 77, 25, 29, 27, 28, 17,
30
+ 19, 20, 21, 22, 23, 24, 26, 17, 58, 30,
31
+ 16, 25, 18, 79, 29, 27, 28, 56, 19, 20,
32
+ 21, 22, 23, 24, 26, 53, 16, 30, 18, 25,
33
+ 85, 52, 84, 29, 27, 28, 18, 19, 20, 21,
34
+ 22, 23, 24, 26, 16, 73, 30, 88, 25, 29,
35
+ 27, 28, 51, 19, 20, 21, 22, 23, 24, 26,
36
+ 31, 77, 30, 16, 25, 29, 27, 28, 77, 19,
37
+ 20, 21, 22, 23, 24, 26, 48, 94, 30, 16,
38
+ 25, 29, 27, 28, 33, 19, 20, 21, 22, 23,
39
+ 24, 26, nil, nil, 30, 16, 25, 29, 27, 28,
40
+ nil, 19, 20, 21, 22, 23, 24, 26, nil, nil,
41
+ 30, 16, 25, 29, 27, 28, nil, 19, 20, 21,
42
+ 22, 23, 24, 26, nil, nil, 30, 16, 25, 29,
43
+ 27, 28, nil, 19, 20, 21, 22, 23, 24, 26,
44
+ nil, nil, 30, 16, 25, 29, 27, 28, nil, 19,
45
+ 20, 21, 22, 23, 24, 26, nil, nil, 30, 16,
46
+ 25, 29, 27, 28, nil, 19, 20, 21, 22, 23,
47
+ 24, 26, nil, nil, 30, 16, 25, 29, 27, 28,
48
+ nil, 19, 20, 21, 22, 23, 24, 26, nil, nil,
49
+ 30, 16, 25, 29, 27, 28, nil, 19, 20, 21,
50
+ 22, 23, 24, 26, nil, nil, 30, 16, 25, 29,
51
+ 27, 28, nil, 19, 20, 21, 22, 23, 24, 26,
52
+ nil, nil, 30, 16, 25, 29, 27, 28, nil, 19,
53
+ 20, 21, 22, 23, 24, 26, nil, nil, 30, 16,
54
+ 25, 29, 27, 28, nil, 19, 20, 21, 22, 23,
55
+ 24, 26, nil, nil, 30, 16, 25, 29, 27, 28,
56
+ nil, 19, 20, 21, 22, 23, 24, 26, nil, nil,
57
+ 30, 16, 25, 29, 27, 28, nil, 19, 20, 21,
58
+ 22, 23, 24, 26, nil, nil, 30, 16, 25, 29,
59
+ 27, 28, nil, 19, 20, 21, 22, 23, 24, 26,
60
+ nil, nil, 30, 16, 25, 29, 27, 28, nil, 19,
61
+ 20, 21, 22, 23, 24, 26, nil, nil, 30, 16,
62
+ 25, 29, 27, 28, 17, 19, 20, 21, 22, 23,
63
+ 24, 26, nil, 90, 30, 16, 25, 29, 27, 28,
64
+ nil, 19, 20, 21, 22, 23, 24, 26, nil, nil,
65
+ 30, 16, 25, 18, 33, nil, 44, 45, 42, 43,
66
+ 38, 39, 40, 41, 36, 37, 33, 16, 44, 45,
67
+ 42, 43, 38, 39, 40, 41, 36, 37, 35, 34,
68
+ 49, 77, 48, 71, 33, nil, 44, 45, 42, 43,
69
+ 38, 39, 40, 41, 36, 37, 35, 34, 77, nil,
70
+ 92, 33, 91, 44, 45, 42, 43, 38, 39, 40,
71
+ 41, 36, 37, 35, 34, 33, nil, 44, 45, 42,
72
+ 43, 38, 39, 40, 41, 36, 37, 35, 34, 33,
73
+ nil, 44, 45, 42, 43, 38, 39, 40, 41, 36,
74
+ 37, 35, 34, 33, nil, 44, 45, 42, 43, 38,
75
+ 39, 40, 41, 36, 37, 35, 34, 33, nil, 44,
76
+ 45, 42, 43, 38, 39, 40, 41, 36, 37, 35,
77
+ 34, 33, nil, 44, 45, 42, 43, 38, 39, 40,
78
+ 41, 36, 37, 35, 34, 33, nil, 44, 45, 42,
79
+ 43, 38, 39, 40, 41, 36, 37, 35, 34, 33,
80
+ nil, 44, 45, 42, 43, 38, 39, 40, 41, 36,
81
+ 37, 35, 33, nil, 44, 45, 42, 43, 38, 39,
82
+ 40, 41, 33, nil, 44, 45, 42, 43, 38, 39,
83
+ 40, 41, 33, nil, 44, 45, 42, 43, 33, nil,
84
+ 44, 45, 42, 43, 33, nil, 44, 45, 42, 43,
85
+ 33, nil, 44, 45, 42, 43, 33, nil, 44, 45,
86
+ 33, nil, 44, 45 ]
75
87
 
76
88
  racc_action_check = [
77
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
78
- 0, 72, 72, 72, 72, 72, 72, 72, 72, 72,
79
- 72, 72, 58, 48, 58, 58, 58, 58, 86, 0,
80
- 59, 0, 59, 59, 59, 59, 63, 2, 63, 63,
81
- 72, 48, 72, 45, 45, 45, 28, 45, 45, 45,
82
- 45, 45, 45, 45, 40, 40, 40, 26, 40, 40,
83
- 40, 40, 40, 40, 40, 2, 80, 62, 25, 62,
84
- 62, 24, 45, 45, 60, 80, 60, 60, 60, 60,
85
- 79, 79, 79, 40, 79, 79, 79, 79, 79, 79,
86
- 79, 15, 15, 15, 80, 15, 15, 15, 15, 15,
87
- 15, 15, 23, 69, 23, 69, 39, 39, 39, 79,
88
- 39, 39, 39, 39, 39, 39, 39, 41, 41, 41,
89
- 15, 41, 41, 41, 41, 41, 41, 41, 81, 49,
90
- 81, 53, 47, 47, 47, 39, 47, 47, 47, 47,
91
- 47, 47, 47, 46, 46, 46, 41, 46, 46, 46,
92
- 46, 46, 46, 46, 64, 65, 74, 1, 27, 27,
93
- 27, 47, 27, 27, 27, 27, 27, 27, 27, 29,
94
- 29, 29, 46, 29, 29, 29, 29, 29, 29, 29,
95
- 85, 30, nil, nil, 42, 42, 42, 27, 42, 42,
96
- 42, 42, 42, 42, 42, 31, 31, 31, 29, 31,
97
- 31, 31, 31, 31, 31, 31, nil, nil, nil, nil,
98
- 32, 32, 32, 42, 32, 32, 32, 32, 32, 32,
99
- 32, 33, 33, 33, 31, 33, 33, 33, 33, 33,
100
- 33, 33, nil, nil, nil, nil, 34, 34, 34, 32,
101
- 34, 34, 34, 34, 34, 34, 34, 35, 35, 35,
102
- 33, 35, 35, 35, 35, 35, 35, 35, nil, nil,
103
- nil, nil, 36, 36, 36, 34, 36, 36, 36, 36,
104
- 36, 36, 36, 37, 37, 37, 35, 37, 37, 37,
105
- 37, 37, 37, 37, nil, nil, nil, nil, 38, 38,
106
- 38, 36, 38, 38, 38, 38, 38, 38, 38, nil,
107
- nil, 43, 37, 43, 43, 43, 43, 43, 43, 43,
108
- 43, 43, 43, 43, 43, nil, nil, 38, 43, 50,
109
- nil, 50, nil, 50, 50, 50, 50, 50, 50, 50,
110
- 50, 50, 50, 50, 50, 70, nil, 70, 70, 70,
111
- 70, 70, 70, 70, 70, 70, 70, 70, 70, 71,
112
- nil, 71, 71, 71, 71, 71, 71, 71, 71, 71,
113
- 71, 71, 71, 83, nil, 83, 83, 83, 83, 83,
114
- 83, 83, 83, 83, 83, 83, 83, 67, nil, 67,
115
- 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
116
- 67, 3, nil, 3, 3, 3, 3, 3, 3, 3,
117
- 3, 3, 3, 3, 3, 52, nil, 52, 52, 52,
118
- 52, 52, 52, 52, 52, 52, 52, 52, 52, 54,
119
- nil, 54, 54, 54, 54, 54, 54, 54, 54, 54,
120
- 54, 54, 55, nil, 55, 55, 55, 55, 55, 55,
121
- 55, 55, 55, 55, 56, nil, 56, 56, 56, 56,
122
- 56, 56, 56, 56, 57, nil, 57, 57, 57, 57,
123
- 57, 57, 57, 57, 61, nil, 61, 61, 61, 61 ]
89
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
90
+ 77, 69, 70, 77, 52, 77, 0, 0, 0, 0,
91
+ 0, 0, 0, 0, 0, 0, 0, 2, 33, 0,
92
+ 77, 0, 77, 52, 48, 48, 48, 31, 48, 48,
93
+ 48, 48, 48, 48, 48, 28, 0, 48, 0, 48,
94
+ 74, 27, 74, 16, 16, 16, 2, 16, 16, 16,
95
+ 16, 16, 16, 16, 48, 48, 16, 79, 16, 49,
96
+ 49, 49, 26, 49, 49, 49, 49, 49, 49, 49,
97
+ 1, 91, 49, 16, 49, 25, 25, 25, 53, 25,
98
+ 25, 25, 25, 25, 25, 25, 58, 92, 25, 49,
99
+ 25, 85, 85, 85, 50, 85, 85, 85, 85, 85,
100
+ 85, 85, nil, nil, 85, 25, 85, 29, 29, 29,
101
+ nil, 29, 29, 29, 29, 29, 29, 29, nil, nil,
102
+ 29, 85, 29, 30, 30, 30, nil, 30, 30, 30,
103
+ 30, 30, 30, 30, nil, nil, 30, 29, 30, 45,
104
+ 45, 45, nil, 45, 45, 45, 45, 45, 45, 45,
105
+ nil, nil, 45, 30, 45, 32, 32, 32, nil, 32,
106
+ 32, 32, 32, 32, 32, 32, nil, nil, 32, 45,
107
+ 32, 44, 44, 44, nil, 44, 44, 44, 44, 44,
108
+ 44, 44, nil, nil, 44, 32, 44, 34, 34, 34,
109
+ nil, 34, 34, 34, 34, 34, 34, 34, nil, nil,
110
+ 34, 44, 34, 35, 35, 35, nil, 35, 35, 35,
111
+ 35, 35, 35, 35, nil, nil, 35, 34, 35, 36,
112
+ 36, 36, nil, 36, 36, 36, 36, 36, 36, 36,
113
+ nil, nil, 36, 35, 36, 37, 37, 37, nil, 37,
114
+ 37, 37, 37, 37, 37, 37, nil, nil, 37, 36,
115
+ 37, 38, 38, 38, nil, 38, 38, 38, 38, 38,
116
+ 38, 38, nil, nil, 38, 37, 38, 39, 39, 39,
117
+ nil, 39, 39, 39, 39, 39, 39, 39, nil, nil,
118
+ 39, 38, 39, 40, 40, 40, nil, 40, 40, 40,
119
+ 40, 40, 40, 40, nil, nil, 40, 39, 40, 42,
120
+ 42, 42, nil, 42, 42, 42, 42, 42, 42, 42,
121
+ nil, nil, 42, 40, 42, 41, 41, 41, nil, 41,
122
+ 41, 41, 41, 41, 41, 41, nil, nil, 41, 42,
123
+ 41, 43, 43, 43, 86, 43, 43, 43, 43, 43,
124
+ 43, 43, nil, 86, 43, 41, 43, 51, 51, 51,
125
+ nil, 51, 51, 51, 51, 51, 51, 51, nil, nil,
126
+ 51, 43, 51, 86, 60, nil, 60, 60, 60, 60,
127
+ 60, 60, 60, 60, 60, 60, 46, 51, 46, 46,
128
+ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
129
+ 24, 55, 24, 46, 55, nil, 55, 55, 55, 55,
130
+ 55, 55, 55, 55, 55, 55, 55, 55, 54, nil,
131
+ 87, 54, 87, 54, 54, 54, 54, 54, 54, 54,
132
+ 54, 54, 54, 54, 54, 89, nil, 89, 89, 89,
133
+ 89, 89, 89, 89, 89, 89, 89, 89, 89, 72,
134
+ nil, 72, 72, 72, 72, 72, 72, 72, 72, 72,
135
+ 72, 72, 72, 75, nil, 75, 75, 75, 75, 75,
136
+ 75, 75, 75, 75, 75, 75, 75, 76, nil, 76,
137
+ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
138
+ 76, 3, nil, 3, 3, 3, 3, 3, 3, 3,
139
+ 3, 3, 3, 3, 3, 57, nil, 57, 57, 57,
140
+ 57, 57, 57, 57, 57, 57, 57, 57, 57, 59,
141
+ nil, 59, 59, 59, 59, 59, 59, 59, 59, 59,
142
+ 59, 59, 61, nil, 61, 61, 61, 61, 61, 61,
143
+ 61, 61, 62, nil, 62, 62, 62, 62, 62, 62,
144
+ 62, 62, 66, nil, 66, 66, 66, 66, 63, nil,
145
+ 63, 63, 63, 63, 65, nil, 65, 65, 65, 65,
146
+ 64, nil, 64, 64, 64, 64, 68, nil, 68, 68,
147
+ 67, nil, 67, 67 ]
124
148
 
125
149
  racc_action_pointer = [
126
- -2, 157, 32, 376, nil, nil, nil, nil, nil, nil,
127
- nil, nil, nil, nil, nil, 89, nil, nil, nil, nil,
128
- nil, nil, nil, 73, 42, 57, 45, 156, 46, 167,
129
- 170, 193, 208, 219, 234, 245, 260, 271, 286, 104,
130
- 52, 115, 182, 286, nil, 41, 141, 130, 10, 116,
131
- 306, nil, 390, 100, 404, 417, 429, 439, 7, 15,
132
- 59, 449, 52, 21, 139, 140, nil, 362, nil, 73,
133
- 320, 334, 9, nil, 145, nil, nil, nil, nil, 78,
134
- 61, 98, nil, 348, nil, 167, 17, nil, nil ]
150
+ 14, 80, 22, 475, nil, nil, nil, nil, nil, nil,
151
+ nil, nil, nil, nil, nil, nil, 51, nil, nil, nil,
152
+ nil, nil, nil, nil, 370, 83, 42, 40, 33, 115,
153
+ 131, 37, 163, 17, 195, 211, 227, 243, 259, 275,
154
+ 291, 323, 307, 339, 179, 147, 370, nil, 32, 67,
155
+ 88, 355, 1, 75, 405, 388, nil, 489, 64, 503,
156
+ 358, 516, 526, 542, 554, 548, 536, 564, 560, -5,
157
+ -4, nil, 433, nil, 19, 447, 461, -2, nil, 56,
158
+ nil, nil, nil, nil, nil, 99, 339, 389, nil, 419,
159
+ nil, 68, 86, nil, nil ]
135
160
 
136
161
  racc_action_default = [
137
- -1, -56, -2, -3, -6, -7, -8, -9, -10, -11,
138
- -12, -13, -14, -15, -16, -56, -18, -19, -20, -21,
139
- -22, -23, -24, -46, -44, -56, -56, -56, -56, -5,
140
- -56, -56, -56, -56, -56, -56, -56, -56, -56, -56,
141
- -56, -56, -56, -56, -25, -56, -56, -56, -56, -56,
142
- -56, 89, -4, -27, -32, -33, -34, -35, -36, -37,
143
- -38, -39, -40, -41, -42, -43, -17, -30, -28, -56,
144
- -47, -45, -56, -49, -51, -54, -55, -26, -29, -56,
145
- -56, -56, -52, -31, -48, -56, -56, -50, -53 ]
162
+ -1, -59, -2, -3, -6, -7, -8, -9, -10, -11,
163
+ -12, -13, -14, -15, -16, -17, -59, -19, -20, -21,
164
+ -22, -23, -24, -25, -48, -59, -46, -59, -59, -59,
165
+ -59, -59, -5, -59, -59, -59, -59, -59, -59, -59,
166
+ -59, -59, -59, -59, -59, -59, -59, -26, -59, -59,
167
+ -45, -59, -59, -59, -59, -59, 95, -4, -28, -33,
168
+ -34, -35, -36, -37, -38, -39, -40, -41, -42, -43,
169
+ -44, -18, -31, -29, -59, -49, -47, -59, -51, -53,
170
+ -56, -57, -58, -27, -30, -59, -59, -59, -54, -32,
171
+ -50, -59, -59, -52, -55 ]
146
172
 
147
173
  racc_goto_table = [
148
- 29, 2, 43, 73, 75, 76, 44, 81, 69, 1,
149
- nil, nil, nil, nil, 50, nil, 52, nil, 54, 55,
150
- 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
151
- nil, nil, 67, 70, 71, nil, 77, nil, nil, nil,
152
- 87, nil, nil, nil, nil, nil, nil, nil, nil, nil,
174
+ 32, 2, 46, 78, 80, 81, 82, 47, 87, 74,
175
+ 1, 50, nil, nil, nil, 54, 55, nil, 57, nil,
176
+ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
177
+ 69, 70, nil, nil, 72, 75, nil, 76, nil, nil,
178
+ nil, 83, 93, nil, nil, nil, nil, nil, nil, nil,
153
179
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
154
- nil, nil, nil, nil, nil, nil, 83, nil, nil, nil,
155
- nil, nil, nil, 80, nil, nil, nil, nil, 29 ]
180
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
181
+ nil, 89, nil, nil, nil, nil, nil, nil, 86, nil,
182
+ nil, nil, nil, nil, 32 ]
156
183
 
157
184
  racc_goto_check = [
158
- 4, 2, 3, 17, 17, 17, 15, 18, 16, 1,
159
- nil, nil, nil, nil, 3, nil, 3, nil, 3, 3,
185
+ 4, 2, 3, 18, 18, 18, 18, 16, 19, 17,
186
+ 1, 3, nil, nil, nil, 3, 3, nil, 3, nil,
160
187
  3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
161
- nil, nil, 3, 3, 3, nil, 15, nil, nil, nil,
162
- 17, nil, nil, nil, nil, nil, nil, nil, nil, nil,
188
+ 3, 3, nil, nil, 3, 3, nil, 3, nil, nil,
189
+ nil, 16, 18, nil, nil, nil, nil, nil, nil, nil,
190
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
163
191
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
164
- nil, nil, nil, nil, nil, nil, 3, nil, nil, nil,
165
- nil, nil, nil, 2, nil, nil, nil, nil, 4 ]
192
+ nil, 3, nil, nil, nil, nil, nil, nil, 2, nil,
193
+ nil, nil, nil, nil, 4 ]
166
194
 
167
195
  racc_goto_pointer = [
168
- nil, 9, 1, -13, -2, nil, nil, nil, nil, nil,
169
- nil, nil, nil, nil, nil, -17, -37, -45, -67 ]
196
+ nil, 10, 1, -14, -2, nil, nil, nil, nil, nil,
197
+ nil, nil, nil, nil, nil, nil, -17, -39, -49, -71 ]
170
198
 
171
199
  racc_goto_default = [
172
200
  nil, nil, nil, 3, 4, 5, 6, 7, 8, 9,
173
- 10, 11, 12, 13, 14, nil, nil, nil, nil ]
201
+ 10, 11, 12, 13, 14, 15, nil, nil, nil, nil ]
174
202
 
175
203
  racc_reduce_table = [
176
204
  0, 0, :racc_error,
177
- 0, 35, :_reduce_1,
178
- 1, 35, :_reduce_2,
179
- 1, 36, :_reduce_3,
180
- 3, 36, :_reduce_4,
181
- 2, 36, :_reduce_5,
182
- 1, 36, :_reduce_6,
183
- 1, 37, :_reduce_none,
184
- 1, 37, :_reduce_none,
185
- 1, 37, :_reduce_none,
186
- 1, 37, :_reduce_none,
187
- 1, 37, :_reduce_none,
188
- 1, 37, :_reduce_none,
189
- 1, 37, :_reduce_none,
190
- 1, 37, :_reduce_none,
191
- 1, 37, :_reduce_none,
192
- 1, 37, :_reduce_none,
193
- 3, 37, :_reduce_17,
205
+ 0, 36, :_reduce_1,
206
+ 1, 36, :_reduce_2,
207
+ 1, 37, :_reduce_3,
208
+ 3, 37, :_reduce_4,
209
+ 2, 37, :_reduce_5,
210
+ 1, 37, :_reduce_6,
211
+ 1, 38, :_reduce_none,
212
+ 1, 38, :_reduce_none,
213
+ 1, 38, :_reduce_none,
214
+ 1, 38, :_reduce_none,
215
+ 1, 38, :_reduce_none,
194
216
  1, 38, :_reduce_none,
195
217
  1, 38, :_reduce_none,
196
- 1, 39, :_reduce_20,
197
- 1, 39, :_reduce_21,
198
- 1, 39, :_reduce_22,
199
- 1, 39, :_reduce_23,
200
- 1, 39, :_reduce_24,
201
- 2, 40, :_reduce_25,
202
- 4, 40, :_reduce_26,
203
- 3, 40, :_reduce_27,
204
- 2, 49, :_reduce_28,
205
- 3, 49, :_reduce_29,
206
- 1, 50, :_reduce_30,
207
- 3, 50, :_reduce_31,
208
- 3, 41, :_reduce_32,
209
- 3, 41, :_reduce_33,
210
- 3, 41, :_reduce_34,
211
- 3, 41, :_reduce_35,
212
- 3, 41, :_reduce_36,
213
- 3, 41, :_reduce_37,
214
- 3, 41, :_reduce_38,
215
- 3, 41, :_reduce_39,
216
- 3, 41, :_reduce_40,
217
- 3, 41, :_reduce_41,
218
- 3, 41, :_reduce_42,
219
- 3, 41, :_reduce_43,
220
- 1, 42, :_reduce_44,
221
- 3, 43, :_reduce_45,
222
- 1, 44, :_reduce_46,
223
- 3, 45, :_reduce_47,
224
- 3, 51, :_reduce_48,
218
+ 1, 38, :_reduce_none,
219
+ 1, 38, :_reduce_none,
220
+ 1, 38, :_reduce_none,
221
+ 1, 38, :_reduce_none,
222
+ 3, 38, :_reduce_18,
223
+ 1, 39, :_reduce_none,
224
+ 1, 39, :_reduce_none,
225
+ 1, 40, :_reduce_21,
226
+ 1, 40, :_reduce_22,
227
+ 1, 40, :_reduce_23,
228
+ 1, 40, :_reduce_24,
229
+ 1, 40, :_reduce_25,
230
+ 2, 41, :_reduce_26,
231
+ 4, 41, :_reduce_27,
232
+ 3, 41, :_reduce_28,
233
+ 2, 51, :_reduce_29,
234
+ 3, 51, :_reduce_30,
235
+ 1, 52, :_reduce_31,
236
+ 3, 52, :_reduce_32,
237
+ 3, 42, :_reduce_33,
238
+ 3, 42, :_reduce_34,
239
+ 3, 42, :_reduce_35,
240
+ 3, 42, :_reduce_36,
241
+ 3, 42, :_reduce_37,
242
+ 3, 42, :_reduce_38,
243
+ 3, 42, :_reduce_39,
244
+ 3, 42, :_reduce_40,
245
+ 3, 42, :_reduce_41,
246
+ 3, 42, :_reduce_42,
247
+ 3, 42, :_reduce_43,
248
+ 3, 42, :_reduce_44,
249
+ 2, 42, :_reduce_45,
250
+ 1, 43, :_reduce_46,
251
+ 3, 44, :_reduce_47,
252
+ 1, 45, :_reduce_48,
225
253
  3, 46, :_reduce_49,
226
- 6, 46, :_reduce_50,
227
- 0, 52, :_reduce_51,
228
- 1, 52, :_reduce_52,
229
- 3, 52, :_reduce_53,
230
- 3, 47, :_reduce_54,
231
- 3, 48, :_reduce_55 ]
254
+ 3, 53, :_reduce_50,
255
+ 3, 47, :_reduce_51,
256
+ 6, 47, :_reduce_52,
257
+ 0, 54, :_reduce_53,
258
+ 1, 54, :_reduce_54,
259
+ 3, 54, :_reduce_55,
260
+ 3, 48, :_reduce_56,
261
+ 3, 49, :_reduce_57,
262
+ 3, 50, :_reduce_58 ]
232
263
 
233
- racc_reduce_n = 56
264
+ racc_reduce_n = 59
234
265
 
235
- racc_shift_n = 89
266
+ racc_shift_n = 95
236
267
 
237
268
  racc_token_table = {
238
269
  false => 0,
@@ -250,27 +281,28 @@ racc_token_table = {
250
281
  :CONSTANT => 12,
251
282
  :INDENT => 13,
252
283
  :DEDENT => 14,
253
- "." => 15,
254
- "!" => 16,
255
- "*" => 17,
256
- "/" => 18,
257
- "+" => 19,
258
- "-" => 20,
259
- ">" => 21,
260
- ">=" => 22,
261
- "<" => 23,
262
- "<=" => 24,
263
- "==" => 25,
264
- "!=" => 26,
265
- "&&" => 27,
266
- "||" => 28,
267
- "=" => 29,
268
- "," => 30,
269
- "(" => 31,
270
- ")" => 32,
271
- ";" => 33 }
272
-
273
- racc_nt_base = 34
284
+ :WHILE => 15,
285
+ "." => 16,
286
+ "!" => 17,
287
+ "*" => 18,
288
+ "/" => 19,
289
+ "+" => 20,
290
+ "-" => 21,
291
+ ">" => 22,
292
+ ">=" => 23,
293
+ "<" => 24,
294
+ "<=" => 25,
295
+ "==" => 26,
296
+ "!=" => 27,
297
+ "&&" => 28,
298
+ "||" => 29,
299
+ "=" => 30,
300
+ "," => 31,
301
+ "(" => 32,
302
+ ")" => 33,
303
+ ";" => 34 }
304
+
305
+ racc_nt_base = 35
274
306
 
275
307
  racc_use_result_var = true
276
308
 
@@ -306,6 +338,7 @@ Racc_token_to_s_table = [
306
338
  "CONSTANT",
307
339
  "INDENT",
308
340
  "DEDENT",
341
+ "WHILE",
309
342
  "\".\"",
310
343
  "\"!\"",
311
344
  "\"*\"",
@@ -340,6 +373,7 @@ Racc_token_to_s_table = [
340
373
  "Def",
341
374
  "Class",
342
375
  "If",
376
+ "While",
343
377
  "Arguments",
344
378
  "ArgList",
345
379
  "Block",
@@ -351,42 +385,42 @@ Racc_debug_parser = false
351
385
 
352
386
  # reduce 0 omitted
353
387
 
354
- module_eval(<<'.,.,', 'grammar.y', 49)
388
+ module_eval(<<'.,.,', 'grammar.y', 50)
355
389
  def _reduce_1(val, _values, result)
356
390
  result = Nodes.new([])
357
391
  result
358
392
  end
359
393
  .,.,
360
394
 
361
- module_eval(<<'.,.,', 'grammar.y', 50)
395
+ module_eval(<<'.,.,', 'grammar.y', 51)
362
396
  def _reduce_2(val, _values, result)
363
397
  result = val[0]
364
398
  result
365
399
  end
366
400
  .,.,
367
401
 
368
- module_eval(<<'.,.,', 'grammar.y', 67)
402
+ module_eval(<<'.,.,', 'grammar.y', 68)
369
403
  def _reduce_3(val, _values, result)
370
404
  result = Nodes.new(val)
371
405
  result
372
406
  end
373
407
  .,.,
374
408
 
375
- module_eval(<<'.,.,', 'grammar.y', 68)
409
+ module_eval(<<'.,.,', 'grammar.y', 69)
376
410
  def _reduce_4(val, _values, result)
377
411
  result = val[0] << val[2]
378
412
  result
379
413
  end
380
414
  .,.,
381
415
 
382
- module_eval(<<'.,.,', 'grammar.y', 69)
416
+ module_eval(<<'.,.,', 'grammar.y', 70)
383
417
  def _reduce_5(val, _values, result)
384
418
  result = val[0]
385
419
  result
386
420
  end
387
421
  .,.,
388
422
 
389
- module_eval(<<'.,.,', 'grammar.y', 70)
423
+ module_eval(<<'.,.,', 'grammar.y', 71)
390
424
  def _reduce_6(val, _values, result)
391
425
  result = Nodes.new([])
392
426
  result
@@ -413,269 +447,285 @@ module_eval(<<'.,.,', 'grammar.y', 70)
413
447
 
414
448
  # reduce 16 omitted
415
449
 
416
- module_eval(<<'.,.,', 'grammar.y', 85)
417
- def _reduce_17(val, _values, result)
450
+ # reduce 17 omitted
451
+
452
+ module_eval(<<'.,.,', 'grammar.y', 87)
453
+ def _reduce_18(val, _values, result)
418
454
  result = val[1]
419
455
  result
420
456
  end
421
457
  .,.,
422
458
 
423
- # reduce 18 omitted
424
-
425
459
  # reduce 19 omitted
426
460
 
427
- module_eval(<<'.,.,', 'grammar.y', 103)
428
- def _reduce_20(val, _values, result)
429
- result = NumberNode.new(val[0])
430
- result
431
- end
432
- .,.,
461
+ # reduce 20 omitted
433
462
 
434
- module_eval(<<'.,.,', 'grammar.y', 104)
463
+ module_eval(<<'.,.,', 'grammar.y', 105)
435
464
  def _reduce_21(val, _values, result)
436
- result = StringNode.new(val[0])
465
+ result = NumberNode.new(val[0])
437
466
  result
438
467
  end
439
468
  .,.,
440
469
 
441
- module_eval(<<'.,.,', 'grammar.y', 105)
470
+ module_eval(<<'.,.,', 'grammar.y', 106)
442
471
  def _reduce_22(val, _values, result)
443
- result = TrueNode.new
472
+ result = StringNode.new(val[0])
444
473
  result
445
474
  end
446
475
  .,.,
447
476
 
448
- module_eval(<<'.,.,', 'grammar.y', 106)
477
+ module_eval(<<'.,.,', 'grammar.y', 107)
449
478
  def _reduce_23(val, _values, result)
450
- result = FalseNode.new
479
+ result = TrueNode.new
451
480
  result
452
481
  end
453
482
  .,.,
454
483
 
455
- module_eval(<<'.,.,', 'grammar.y', 107)
484
+ module_eval(<<'.,.,', 'grammar.y', 108)
456
485
  def _reduce_24(val, _values, result)
457
- result = NilNode.new
486
+ result = FalseNode.new
458
487
  result
459
488
  end
460
489
  .,.,
461
490
 
462
- module_eval(<<'.,.,', 'grammar.y', 119)
491
+ module_eval(<<'.,.,', 'grammar.y', 109)
463
492
  def _reduce_25(val, _values, result)
464
- result = CallNode.new(nil, val[0], val[1])
493
+ result = NilNode.new
465
494
  result
466
495
  end
467
496
  .,.,
468
497
 
469
498
  module_eval(<<'.,.,', 'grammar.y', 121)
470
499
  def _reduce_26(val, _values, result)
471
- result = CallNode.new(val[0], val[2], val[3])
500
+ result = CallNode.new(nil, val[0], val[1])
472
501
  result
473
502
  end
474
503
  .,.,
475
504
 
476
- module_eval(<<'.,.,', 'grammar.y', 122)
505
+ module_eval(<<'.,.,', 'grammar.y', 123)
477
506
  def _reduce_27(val, _values, result)
478
- result = CallNode.new(val[0], val[2], [])
507
+ result = CallNode.new(val[0], val[2], val[3])
479
508
  result
480
509
  end
481
510
  .,.,
482
511
 
483
- module_eval(<<'.,.,', 'grammar.y', 126)
512
+ module_eval(<<'.,.,', 'grammar.y', 124)
484
513
  def _reduce_28(val, _values, result)
485
- result = []
514
+ result = CallNode.new(val[0], val[2], [])
486
515
  result
487
516
  end
488
517
  .,.,
489
518
 
490
- module_eval(<<'.,.,', 'grammar.y', 127)
519
+ module_eval(<<'.,.,', 'grammar.y', 128)
491
520
  def _reduce_29(val, _values, result)
492
- result = val[1]
521
+ result = []
493
522
  result
494
523
  end
495
524
  .,.,
496
525
 
497
- module_eval(<<'.,.,', 'grammar.y', 131)
526
+ module_eval(<<'.,.,', 'grammar.y', 129)
498
527
  def _reduce_30(val, _values, result)
499
- result = val
528
+ result = val[1]
500
529
  result
501
530
  end
502
531
  .,.,
503
532
 
504
- module_eval(<<'.,.,', 'grammar.y', 132)
533
+ module_eval(<<'.,.,', 'grammar.y', 133)
505
534
  def _reduce_31(val, _values, result)
506
- result = val[0] << val[2]
535
+ result = val
507
536
  result
508
537
  end
509
538
  .,.,
510
539
 
511
- module_eval(<<'.,.,', 'grammar.y', 143)
540
+ module_eval(<<'.,.,', 'grammar.y', 134)
512
541
  def _reduce_32(val, _values, result)
513
- result = CallNode.new(val[0], val[1], [val[2]])
542
+ result = val[0] << val[2]
514
543
  result
515
544
  end
516
545
  .,.,
517
546
 
518
- module_eval(<<'.,.,', 'grammar.y', 144)
547
+ module_eval(<<'.,.,', 'grammar.y', 145)
519
548
  def _reduce_33(val, _values, result)
520
549
  result = CallNode.new(val[0], val[1], [val[2]])
521
550
  result
522
551
  end
523
552
  .,.,
524
553
 
525
- module_eval(<<'.,.,', 'grammar.y', 145)
554
+ module_eval(<<'.,.,', 'grammar.y', 146)
526
555
  def _reduce_34(val, _values, result)
527
556
  result = CallNode.new(val[0], val[1], [val[2]])
528
557
  result
529
558
  end
530
559
  .,.,
531
560
 
532
- module_eval(<<'.,.,', 'grammar.y', 146)
561
+ module_eval(<<'.,.,', 'grammar.y', 147)
533
562
  def _reduce_35(val, _values, result)
534
563
  result = CallNode.new(val[0], val[1], [val[2]])
535
564
  result
536
565
  end
537
566
  .,.,
538
567
 
539
- module_eval(<<'.,.,', 'grammar.y', 147)
568
+ module_eval(<<'.,.,', 'grammar.y', 148)
540
569
  def _reduce_36(val, _values, result)
541
570
  result = CallNode.new(val[0], val[1], [val[2]])
542
571
  result
543
572
  end
544
573
  .,.,
545
574
 
546
- module_eval(<<'.,.,', 'grammar.y', 148)
575
+ module_eval(<<'.,.,', 'grammar.y', 149)
547
576
  def _reduce_37(val, _values, result)
548
577
  result = CallNode.new(val[0], val[1], [val[2]])
549
578
  result
550
579
  end
551
580
  .,.,
552
581
 
553
- module_eval(<<'.,.,', 'grammar.y', 149)
582
+ module_eval(<<'.,.,', 'grammar.y', 150)
554
583
  def _reduce_38(val, _values, result)
555
584
  result = CallNode.new(val[0], val[1], [val[2]])
556
585
  result
557
586
  end
558
587
  .,.,
559
588
 
560
- module_eval(<<'.,.,', 'grammar.y', 150)
589
+ module_eval(<<'.,.,', 'grammar.y', 151)
561
590
  def _reduce_39(val, _values, result)
562
591
  result = CallNode.new(val[0], val[1], [val[2]])
563
592
  result
564
593
  end
565
594
  .,.,
566
595
 
567
- module_eval(<<'.,.,', 'grammar.y', 151)
596
+ module_eval(<<'.,.,', 'grammar.y', 152)
568
597
  def _reduce_40(val, _values, result)
569
598
  result = CallNode.new(val[0], val[1], [val[2]])
570
599
  result
571
600
  end
572
601
  .,.,
573
602
 
574
- module_eval(<<'.,.,', 'grammar.y', 152)
603
+ module_eval(<<'.,.,', 'grammar.y', 153)
575
604
  def _reduce_41(val, _values, result)
576
605
  result = CallNode.new(val[0], val[1], [val[2]])
577
606
  result
578
607
  end
579
608
  .,.,
580
609
 
581
- module_eval(<<'.,.,', 'grammar.y', 153)
610
+ module_eval(<<'.,.,', 'grammar.y', 154)
582
611
  def _reduce_42(val, _values, result)
583
612
  result = CallNode.new(val[0], val[1], [val[2]])
584
613
  result
585
614
  end
586
615
  .,.,
587
616
 
588
- module_eval(<<'.,.,', 'grammar.y', 154)
617
+ module_eval(<<'.,.,', 'grammar.y', 155)
589
618
  def _reduce_43(val, _values, result)
590
619
  result = CallNode.new(val[0], val[1], [val[2]])
591
620
  result
592
621
  end
593
622
  .,.,
594
623
 
595
- module_eval(<<'.,.,', 'grammar.y', 159)
624
+ module_eval(<<'.,.,', 'grammar.y', 156)
596
625
  def _reduce_44(val, _values, result)
597
- result = GetConstantNode.new(val[0])
626
+ result = CallNode.new(val[0], val[1], [val[2]])
598
627
  result
599
628
  end
600
629
  .,.,
601
630
 
602
- module_eval(<<'.,.,', 'grammar.y', 163)
631
+ module_eval(<<'.,.,', 'grammar.y', 157)
603
632
  def _reduce_45(val, _values, result)
604
- result = SetConstantNode.new(val[0], val[2])
633
+ result = CallNode.new(val[1], val[0], [])
605
634
  result
606
635
  end
607
636
  .,.,
608
637
 
609
- module_eval(<<'.,.,', 'grammar.y', 167)
638
+ module_eval(<<'.,.,', 'grammar.y', 162)
610
639
  def _reduce_46(val, _values, result)
611
- result = GetLocalNode.new(val[0])
640
+ result = GetConstantNode.new(val[0])
612
641
  result
613
642
  end
614
643
  .,.,
615
644
 
616
- module_eval(<<'.,.,', 'grammar.y', 171)
645
+ module_eval(<<'.,.,', 'grammar.y', 166)
617
646
  def _reduce_47(val, _values, result)
618
- result = SetLocalNode.new(val[0], val[2])
647
+ result = SetConstantNode.new(val[0], val[2])
619
648
  result
620
649
  end
621
650
  .,.,
622
651
 
623
- module_eval(<<'.,.,', 'grammar.y', 183)
652
+ module_eval(<<'.,.,', 'grammar.y', 170)
624
653
  def _reduce_48(val, _values, result)
625
- result = val[1]
654
+ result = GetLocalNode.new(val[0])
626
655
  result
627
656
  end
628
657
  .,.,
629
658
 
630
- module_eval(<<'.,.,', 'grammar.y', 189)
659
+ module_eval(<<'.,.,', 'grammar.y', 174)
631
660
  def _reduce_49(val, _values, result)
632
- result = DefNode.new(val[1], [], val[2])
661
+ result = SetLocalNode.new(val[0], val[2])
633
662
  result
634
663
  end
635
664
  .,.,
636
665
 
637
- module_eval(<<'.,.,', 'grammar.y', 191)
666
+ module_eval(<<'.,.,', 'grammar.y', 186)
638
667
  def _reduce_50(val, _values, result)
639
- result = DefNode.new(val[1], val[3], val[5])
668
+ result = val[1]
640
669
  result
641
670
  end
642
671
  .,.,
643
672
 
644
- module_eval(<<'.,.,', 'grammar.y', 195)
673
+ module_eval(<<'.,.,', 'grammar.y', 192)
645
674
  def _reduce_51(val, _values, result)
646
- result = []
675
+ result = DefNode.new(val[1], [], val[2])
647
676
  result
648
677
  end
649
678
  .,.,
650
679
 
651
- module_eval(<<'.,.,', 'grammar.y', 196)
680
+ module_eval(<<'.,.,', 'grammar.y', 194)
652
681
  def _reduce_52(val, _values, result)
653
- result = val
682
+ result = DefNode.new(val[1], val[3], val[5])
654
683
  result
655
684
  end
656
685
  .,.,
657
686
 
658
- module_eval(<<'.,.,', 'grammar.y', 197)
687
+ module_eval(<<'.,.,', 'grammar.y', 198)
659
688
  def _reduce_53(val, _values, result)
660
- result = val[0] << val[2]
689
+ result = []
661
690
  result
662
691
  end
663
692
  .,.,
664
693
 
665
- module_eval(<<'.,.,', 'grammar.y', 203)
694
+ module_eval(<<'.,.,', 'grammar.y', 199)
666
695
  def _reduce_54(val, _values, result)
667
- result = ClassNode.new(val[1], val[2])
696
+ result = val
668
697
  result
669
698
  end
670
699
  .,.,
671
700
 
672
- module_eval(<<'.,.,', 'grammar.y', 208)
701
+ module_eval(<<'.,.,', 'grammar.y', 200)
673
702
  def _reduce_55(val, _values, result)
703
+ result = val[0] << val[2]
704
+ result
705
+ end
706
+ .,.,
707
+
708
+ module_eval(<<'.,.,', 'grammar.y', 206)
709
+ def _reduce_56(val, _values, result)
710
+ result = ClassNode.new(val[1], val[2])
711
+ result
712
+ end
713
+ .,.,
714
+
715
+ module_eval(<<'.,.,', 'grammar.y', 211)
716
+ def _reduce_57(val, _values, result)
674
717
  result = IfNode.new(val[1], val[2])
675
718
  result
676
719
  end
677
720
  .,.,
678
721
 
722
+ module_eval(<<'.,.,', 'grammar.y', 215)
723
+ def _reduce_58(val, _values, result)
724
+ result = WhileNode.new(val[1], val[2])
725
+ result
726
+ end
727
+ .,.,
728
+
679
729
  def _reduce_none(val, _values, result)
680
730
  val[0]
681
731
  end
@@ -47,3 +47,41 @@ Constants["Number"].def :/ do |receiver,arguments|
47
47
  result = receiver.ruby_value / arguments.first.ruby_value
48
48
  Constants["Number"].new_with_value(result)
49
49
  end
50
+
51
+ Constants["Number"].def :== do |receiver,arguments|
52
+ result = receiver.ruby_value == arguments.first.ruby_value
53
+ Constants["Number"].new_with_value(result)
54
+ end
55
+
56
+ Constants["Number"].def :!= do |receiver,arguments|
57
+ result = receiver.ruby_value != arguments.first.ruby_value
58
+ Constants["Number"].new_with_value(result)
59
+ end
60
+
61
+ Constants["Number"].def :>= do |receiver,arguments|
62
+ result = receiver.ruby_value >= arguments.first.ruby_value
63
+ Constants["Number"].new_with_value(result)
64
+ end
65
+
66
+ Constants["Number"].def :<= do |receiver,arguments|
67
+ result = receiver.ruby_value <= arguments.first.ruby_value
68
+ Constants["Number"].new_with_value(result)
69
+ end
70
+
71
+ Constants["Number"].def :> do |receiver,arguments|
72
+ result = receiver.ruby_value > arguments.first.ruby_value
73
+ Constants["Number"].new_with_value(result)
74
+ end
75
+
76
+ Constants["Number"].def :< do |receiver,arguments|
77
+ result = receiver.ruby_value < arguments.first.ruby_value
78
+ Constants["Number"].new_with_value(result)
79
+ end
80
+
81
+ Constants["TrueClass"].def :! do |receiver,arguments|
82
+ Constants["false"]
83
+ end
84
+
85
+ Constants["FalseClass"].def :! do |receiver,arguments|
86
+ Constants["true"]
87
+ end
@@ -1,3 +1,3 @@
1
1
  module Turmali
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turmali
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eiffel Qiu