fix all the cases, much white noise, array to list, string to sym stuff

This commit is contained in:
Torsten Ruger 2015-09-19 14:53:30 +03:00
parent 3b0b91f2fb
commit 21b652456d
78 changed files with 690 additions and 559 deletions

View File

@ -1,3 +1,4 @@
FooBar FooBar
-- -- -- -- -- --
s(:list, [s(:module, "FooBar")]) s(:expressions,
s(:module, "FooBar"))

View File

@ -1,3 +1,4 @@
foo foo
-- -- -- -- -- --
s(:list, [s(:name, "foo")]) s(:expressions,
s(:name, :foo))

View File

@ -1,3 +1,4 @@
foo_bar foo_bar
-- -- -- -- -- --
s(:list, [s(:name, "foo_bar")]) s(:expressions,
s(:name, :foo_bar))

View File

@ -1,3 +1,4 @@
_bar _bar
-- -- -- -- -- --
s(:list, [s(:name, "_bar")]) s(:expressions,
s(:name, :_bar))

View File

@ -1,3 +1,4 @@
42 42
-- -- -- -- -- --
s(:list, [s(:int, 42)]) s(:expressions,
s(:int, 42))

View File

@ -1,3 +1,4 @@
"hello" "hello"
-- -- -- -- -- --
s(:list, [s(:string, "hello")]) s(:expressions,
s(:string, "hello"))

View File

@ -1,3 +1,4 @@
"hello \nyou" "hello \nyou"
-- -- -- -- -- --
s(:list, [s(:string, "hello \\nyou")]) s(:expressions,
s(:string, "hello \\nyou"))

View File

@ -1,7 +1,8 @@
puts(3 , a ) puts(3 , a )
-- -- -- -- -- --
s(:list, [s(:call, s(:expressions,
s(:name, "puts"), s(:call,
s(:name, :puts),
s(:arguments, s(:arguments,
s(:int, 3), s(:int, 3),
s(:name, "a")))]) s(:name, :a))))

View File

@ -1,7 +1,8 @@
baz(42, foo) baz(42, foo)
-- -- -- -- -- --
s(:list, [s(:call, s(:expressions,
s(:name, "baz"), s(:call,
s(:name, :baz),
s(:arguments, s(:arguments,
s(:int, 42), s(:int, 42),
s(:name, "foo")))]) s(:name, :foo))))

View File

@ -1,6 +1,7 @@
puts( "hello") puts( "hello")
-- -- -- -- -- --
s(:list, [s(:call, s(:expressions,
s(:name, "puts"), s(:call,
s(:name, :puts),
s(:arguments, s(:arguments,
s(:string, "hello")))]) s(:string, "hello"))))

View File

@ -1,7 +1,8 @@
42.put() 42.put()
-- -- -- -- -- --
s(:list, [s(:call, s(:expressions,
s(:name, "put"), s(:call,
s(:name, :put),
s(:arguments), s(:arguments),
s(:receiver, s(:receiver,
s(:int, 42)))]) s(:int, 42))))

View File

@ -1,6 +1,7 @@
puts( 5) puts( 5)
-- -- -- -- -- --
s(:list, [s(:call, s(:expressions,
s(:name, "puts"), s(:call,
s(:name, :puts),
s(:arguments, s(:arguments,
s(:int, 5)))]) s(:int, 5))))

View File

@ -1,6 +1,7 @@
foo(42) foo(42)
-- -- -- -- -- --
s(:list, [s(:call, s(:expressions,
s(:name, "foo"), s(:call,
s(:name, :foo),
s(:arguments, s(:arguments,
s(:int, 42)))]) s(:int, 42))))

View File

@ -1,8 +1,9 @@
Object.foo(42) Object.foo(42)
-- -- -- -- -- --
s(:list, [s(:call, s(:expressions,
s(:name, "foo"), s(:call,
s(:name, :foo),
s(:arguments, s(:arguments,
s(:int, 42)), s(:int, 42)),
s(:receiver, s(:receiver,
s(:module, "Object")))]) s(:module, "Object"))))

View File

@ -1,8 +1,9 @@
my_my.foo(42) my_my.foo(42)
-- -- -- -- -- --
s(:list, [s(:call, s(:expressions,
s(:name, "foo"), s(:call,
s(:name, :foo),
s(:arguments, s(:arguments,
s(:int, 42)), s(:int, 42)),
s(:receiver, s(:receiver,
s(:name, "my_my")))]) s(:name, :my_my))))

View File

@ -1,8 +1,9 @@
self.foo(42) self.foo(42)
-- -- -- -- -- --
s(:list, [s(:call, s(:expressions,
s(:name, "foo"), s(:call,
s(:name, :foo),
s(:arguments, s(:arguments,
s(:int, 42)), s(:int, 42)),
s(:receiver, s(:receiver,
s(:name, "self")))]) s(:name, :self))))

View File

@ -1,7 +1,8 @@
"hello".puts() "hello".puts()
-- -- -- -- -- --
s(:list, [s(:call, s(:expressions,
s(:name, "puts"), s(:call,
s(:name, :puts),
s(:arguments), s(:arguments),
s(:receiver, s(:receiver,
s(:string, "hello")))]) s(:string, "hello"))))

View File

@ -2,9 +2,11 @@ class Foo < Object
ofthen(3 , var) ofthen(3 , var)
end end
-- -- -- -- -- --
s(:list, [s(:class, "Foo", s(:expressions,
s(:module, "Object"), [s(:call, s(:class, :Foo,
s(:name, "ofthen"), s(:derives, :Object),
s(:call,
s(:name, :ofthen),
s(:arguments, s(:arguments,
s(:int, 3), s(:int, 3),
s(:name, "var")))])]) s(:name, :var)))))

View File

@ -5,14 +5,18 @@ class Pifi
end end
end end
-- -- -- -- -- --
s(:list, [s(:class, "Pifi", nil, [s(:call, s(:expressions,
s(:name, "ofthen"), s(:class, :Pifi,
s(:derives, nil),
s(:call,
s(:name, :ofthen),
s(:arguments, s(:arguments,
s(:int, 3), s(:int, 3),
s(:name, "var"))), s(:function, :int, s(:name, :var))),
s(:name, "ofthen"), s(:function, :int,
s(:name, :ofthen),
s(:parameters, s(:parameters,
s(:field, :int, :n), s(:field, :int, :n),
s(:field, :ref, :m)), s(:field, :ref, :m)),
s(:expressions, s(:expressions,
s(:int, 44)))])]) s(:int, 44)))))

View File

@ -8,8 +8,11 @@ class Ifi
end end
end end
-- -- -- -- -- --
s(:list, [s(:class, "Ifi", nil, [s(:function, :int, s(:expressions,
s(:name, "ofthen"), s(:class, :Ifi,
s(:derives, nil),
s(:function, :int,
s(:name, :ofthen),
s(:parameters, s(:parameters,
s(:field, :int, :n)), s(:field, :int, :n)),
s(:expressions, s(:expressions,
@ -18,8 +21,8 @@ s(:list, [s(:class, "Ifi", nil, [s(:function, :int,
s(:int, 0)), s(:int, 0)),
s(:if_true, s(:if_true,
s(:assign, s(:assign,
s(:name, "isit"), s(:name, :isit),
s(:int, 42))), s(:int, 42))),
s(:if_false, [s(:assign, s(:if_false, [s(:assign,
s(:name, "maybenot"), s(:name, :maybenot),
s(:int, 667))]))))])]) s(:int, 667))]))))))

View File

@ -1,7 +1,14 @@
class Foo < Object class Foo < Object
int Foo.test() int test()
43 43
end end
end end
-- -- -- -- -- --
{:expression_list=>[{:module_name=>"Foo", :derived_name=>s(:module, "Object"), :class_expressions=>[{:type=>"int", :receiver=>s(:module, "Foo"), :function_name=>s(:name, "test"), :parameter_list=>[], :expressions=>[s(:int, 43)], :end=>"end"}], :end=>"end"}]} s(:expressions,
s(:class, :Foo,
s(:derives, :Object),
s(:function, :int,
s(:name, :test),
s(:parameters),
s(:expressions,
s(:int, 43)))))

View File

@ -4,8 +4,12 @@ class Foo
end end
end end
-- -- -- -- -- --
s(:list, [s(:class, "Foo", nil, [s(:module, "Boo", [s(:call, s(:expressions,
s(:name, "funcall"), s(:class, :Foo,
s(:derives, nil),
s(:module, :Boo,
s(:call,
s(:name, :funcall),
s(:arguments, s(:arguments,
s(:int, 3), s(:int, 3),
s(:name, "var")))])])]) s(:name, :var))))))

View File

@ -5,15 +5,18 @@ class Opers
end end
end end
-- -- -- -- -- --
s(:list, [s(:class, "Opers", nil, [s(:function, :int, s(:expressions,
s(:name, "foo"), s(:class, :Opers,
s(:derives, nil),
s(:function, :int,
s(:name, :foo),
s(:parameters, s(:parameters,
s(:field, :int, :x)), s(:field, :int, :x)),
s(:expressions, s(:expressions,
s(:name, "int"), s(:name, :int),
s(:assign, s(:assign,
s(:name, "abba"), s(:name, :abba),
s(:int, 5)), s(:int, 5)),
s(:operator, "+", s(:operator, "+",
s(:name, "abba"), s(:name, :abba),
s(:int, 5))))])]) s(:int, 5))))))

View File

@ -2,4 +2,7 @@ class Foo
5 5
end end
-- -- -- -- -- --
s(:list, [s(:class, "Foo", nil, [s(:int, 5)])]) s(:expressions,
s(:class, :Foo,
s(:derives, nil),
s(:int, 5)))

View File

@ -1,3 +1,6 @@
[42, foo] [42, foo]
-- -- -- -- -- --
s(:list, [s(:array, [s(:int, 42), s(:name, "foo")])]) s(:expressions,
s(:array,
s(:int, 42),
s(:name, :foo)))

View File

@ -1,8 +1,11 @@
[ 3 + 4 , foo(22) ] [ 3 + 4 , foo(22) ]
-- -- -- -- -- --
s(:list, [s(:array, [s(:operator, "+", s(:expressions,
s(:array,
s(:operator, "+",
s(:int, 3), s(:int, 3),
s(:int, 4)), s(:call, s(:int, 4)),
s(:name, "foo"), s(:call,
s(:name, :foo),
s(:arguments, s(:arguments,
s(:int, 22)))])]) s(:int, 22)))))

View File

@ -1,5 +1,7 @@
{ foo => 33 } { foo => 33 }
-- -- -- -- -- --
s(:list, [s(:hash, [s(:assoc, s(:expressions,
s(:name, "foo"), s(:hash,
s(:int, 33))])]) s(:assoc,
s(:name, :foo),
s(:int, 33))))

View File

@ -1,5 +1,7 @@
{ foo => true } { foo => true }
-- -- -- -- -- --
s(:list, [s(:hash, [s(:assoc, s(:expressions,
s(:name, "foo"), s(:hash,
s(:true))])]) s(:assoc,
s(:name, :foo),
s(:true))))

View File

@ -1,7 +1,10 @@
{foo => 33 , bar => 42} {foo => 33 , bar => 42}
-- -- -- -- -- --
s(:list, [s(:hash, [s(:assoc, s(:expressions,
s(:name, "foo"), s(:hash,
s(:int, 33)), s(:assoc, s(:assoc,
s(:name, "bar"), s(:name, :foo),
s(:int, 42))])]) s(:int, 33)),
s(:assoc,
s(:name, :bar),
s(:int, 42))))

View File

@ -1,3 +1,5 @@
[42] [42]
-- -- -- -- -- --
s(:list, [s(:array, [s(:int, 42)])]) s(:expressions,
s(:array,
s(:int, 42)))

View File

@ -4,9 +4,10 @@ else
667 667
end end
-- -- -- -- -- --
s(:list, [s(:if, s(:expressions,
s(:if,
s(:condition, s(:condition,
s(:int, 0)), s(:int, 0)),
s(:if_true, s(:if_true,
s(:int, 42)), s(:int, 42)),
s(:if_false, [s(:int, 667)]))]) s(:if_false, [s(:int, 667)])))

View File

@ -4,21 +4,22 @@ else
var.new(33) var.new(33)
end end
-- -- -- -- -- --
s(:list, [s(:if, s(:expressions,
s(:if,
s(:condition, s(:condition,
s(:operator, ">", s(:operator, ">",
s(:int, 3), s(:int, 3),
s(:name, "var"))), s(:name, :var))),
s(:if_true, s(:if_true,
s(:call, s(:call,
s(:name, "initialize"), s(:name, :initialize),
s(:arguments, s(:arguments,
s(:int, 3)), s(:int, 3)),
s(:receiver, s(:receiver,
s(:module, "Object")))), s(:module, "Object")))),
s(:if_false, [s(:call, s(:if_false, [s(:call,
s(:name, "new"), s(:name, :new),
s(:arguments, s(:arguments,
s(:int, 33)), s(:int, 33)),
s(:receiver, s(:receiver,
s(:name, "var")))]))]) s(:name, :var)))])))

View File

@ -2,9 +2,10 @@ if(0)
42 42
end end
-- -- -- -- -- --
s(:list, [s(:if, s(:expressions,
s(:if,
s(:condition, s(:condition,
s(:int, 0)), s(:int, 0)),
s(:if_true, s(:if_true,
s(:int, 42)), s(:int, 42)),
s(:if_false, nil))]) s(:if_false, nil)))

View File

@ -2,16 +2,17 @@ if(3 > var)
Object.initialize(3) Object.initialize(3)
end end
-- -- -- -- -- --
s(:list, [s(:if, s(:expressions,
s(:if,
s(:condition, s(:condition,
s(:operator, ">", s(:operator, ">",
s(:int, 3), s(:int, 3),
s(:name, "var"))), s(:name, :var))),
s(:if_true, s(:if_true,
s(:call, s(:call,
s(:name, "initialize"), s(:name, :initialize),
s(:arguments, s(:arguments,
s(:int, 3)), s(:int, 3)),
s(:receiver, s(:receiver,
s(:module, "Object")))), s(:module, "Object")))),
s(:if_false, nil))]) s(:if_false, nil)))

View File

@ -1,5 +1,6 @@
a = 5 a = 5
-- -- -- -- -- --
s(:list, [s(:assign, s(:expressions,
s(:name, "a"), s(:assign,
s(:int, 5))]) s(:name, :a),
s(:int, 5)))

View File

@ -1,5 +1,6 @@
a = 5 a = 5
-- -- -- -- -- --
s(:list, [s(:assign, s(:expressions,
s(:name, "a"), s(:assign,
s(:int, 5))]) s(:name, :a),
s(:int, 5)))

View File

@ -1,5 +1,6 @@
a - b a - b
-- -- -- -- -- --
s(:list, [s(:operator, "-", s(:expressions,
s(:name, "a"), s(:operator, "-",
s(:name, "b"))]) s(:name, :a),
s(:name, :b)))

View File

@ -1,5 +1,6 @@
a - 5 a - 5
-- -- -- -- -- --
s(:list, [s(:operator, "-", s(:expressions,
s(:name, "a"), s(:operator, "-",
s(:int, 5))]) s(:name, :a),
s(:int, 5)))

View File

@ -1,5 +1,6 @@
a - "st" a - "st"
-- -- -- -- -- --
s(:list, [s(:operator, "-", s(:expressions,
s(:name, "a"), s(:operator, "-",
s(:string, "st"))]) s(:name, :a),
s(:string, "st")))

View File

@ -1,5 +1,6 @@
a == true a == true
-- -- -- -- -- --
s(:list, [s(:operator, "==", s(:expressions,
s(:name, "a"), s(:operator, "==",
s(:true))]) s(:name, :a),
s(:true)))

View File

@ -1,5 +1,6 @@
5 / 3 5 / 3
-- -- -- -- -- --
s(:list, [s(:operator, "/", s(:expressions,
s(:operator, "/",
s(:int, 5), s(:int, 5),
s(:int, 3))]) s(:int, 3)))

View File

@ -1,5 +1,6 @@
5 > 3 5 > 3
-- -- -- -- -- --
s(:list, [s(:operator, ">", s(:expressions,
s(:operator, ">",
s(:int, 5), s(:int, 5),
s(:int, 3))]) s(:int, 3)))

View File

@ -1,5 +1,6 @@
5 - 3 5 - 3
-- -- -- -- -- --
s(:list, [s(:operator, "-", s(:expressions,
s(:operator, "-",
s(:int, 5), s(:int, 5),
s(:int, 3))]) s(:int, 3)))

View File

@ -1,5 +1,6 @@
5 * 3 5 * 3
-- -- -- -- -- --
s(:list, [s(:operator, "*", s(:expressions,
s(:operator, "*",
s(:int, 5), s(:int, 5),
s(:int, 3))]) s(:int, 3)))

View File

@ -1,5 +1,6 @@
5 + 3 5 + 3
-- -- -- -- -- --
s(:list, [s(:operator, "+", s(:expressions,
s(:operator, "+",
s(:int, 5), s(:int, 5),
s(:int, 3))]) s(:int, 3)))

View File

@ -1,5 +1,6 @@
5 < 3 5 < 3
-- -- -- -- -- --
s(:list, [s(:operator, "<", s(:expressions,
s(:operator, "<",
s(:int, 5), s(:int, 5),
s(:int, 3))]) s(:int, 3)))

View File

@ -1,7 +1,8 @@
2 + 3 * 4 2 + 3 * 4
-- -- -- -- -- --
s(:list, [s(:operator, "+", s(:expressions,
s(:operator, "+",
s(:int, 2), s(:int, 2),
s(:operator, "*", s(:operator, "*",
s(:int, 3), s(:int, 3),
s(:int, 4)))]) s(:int, 4))))

View File

@ -1,7 +1,8 @@
2 * 3 + 4 2 * 3 + 4
-- -- -- -- -- --
s(:list, [s(:operator, "+", s(:expressions,
s(:operator, "+",
s(:operator, "*", s(:operator, "*",
s(:int, 2), s(:int, 2),
s(:int, 3)), s(:int, 3)),
s(:int, 4))]) s(:int, 4)))

View File

@ -1,7 +1,8 @@
2 + 3 + 4 2 + 3 + 4
-- -- -- -- -- --
s(:list, [s(:operator, "+", s(:expressions,
s(:operator, "+",
s(:operator, "+", s(:operator, "+",
s(:int, 2), s(:int, 2),
s(:int, 3)), s(:int, 3)),
s(:int, 4))]) s(:int, 4)))

View File

@ -1,5 +1,11 @@
int String.length( ref x ) int length( ref x )
length length
end end
-- -- -- -- -- --
{:expression_list=>[{:type=>"int", :receiver=>s(:module, "String"), :function_name=>s(:name, "length"), :parameter_list=>[s(:field, :ref, :x)], :expressions=>[s(:name, "length")], :end=>"end"}]} s(:expressions,
s(:function, :int,
s(:name, :length),
s(:parameters,
s(:field, :ref, :x)),
s(:expressions,
s(:name, :length))))

View File

@ -10,40 +10,41 @@ int fibonaccit(int n)
end end
end end
-- -- -- -- -- --
s(:list, [s(:function, :int, s(:expressions,
s(:name, "fibonaccit"), s(:function, :int,
s(:name, :fibonaccit),
s(:parameters, s(:parameters,
s(:field, :int, :n)), s(:field, :int, :n)),
s(:expressions, s(:expressions,
s(:assign, s(:assign,
s(:name, "a"), s(:name, :a),
s(:int, 0)), s(:int, 0)),
s(:assign, s(:assign,
s(:name, "b"), s(:name, :b),
s(:int, 1)), s(:int, 1)),
s(:while, s(:while,
s(:condition, s(:condition,
s(:operator, ">", s(:operator, ">",
s(:name, "n"), s(:name, :n),
s(:int, 1))), s(:int, 1))),
s(:expressions, s(:expressions,
s(:assign, s(:assign,
s(:name, "tmp"), s(:name, :tmp),
s(:name, "a")), s(:name, :a)),
s(:assign, s(:assign,
s(:name, "a"), s(:name, :a),
s(:name, "b")), s(:name, :b)),
s(:assign, s(:assign,
s(:name, "b"), s(:name, :b),
s(:operator, "+", s(:operator, "+",
s(:name, "tmp"), s(:name, :tmp),
s(:name, "b"))), s(:name, :b))),
s(:call, s(:call,
s(:name, "puts"), s(:name, :puts),
s(:arguments, s(:arguments,
s(:name, "b"))), s(:name, :b))),
s(:assign, s(:assign,
s(:name, "n"), s(:name, :n),
s(:operator, "-", s(:operator, "-",
s(:name, "n"), s(:name, :n),
s(:int, 1)))))))]) s(:int, 1))))))))

View File

@ -6,8 +6,9 @@ ref ofthen(int n)
end end
end end
-- -- -- -- -- --
s(:list, [s(:function, :ref, s(:expressions,
s(:name, "ofthen"), s(:function, :ref,
s(:name, :ofthen),
s(:parameters, s(:parameters,
s(:field, :int, :n)), s(:field, :int, :n)),
s(:expressions, s(:expressions,
@ -16,8 +17,8 @@ s(:list, [s(:function, :ref,
s(:int, 0)), s(:int, 0)),
s(:if_true, s(:if_true,
s(:assign, s(:assign,
s(:name, "isit"), s(:name, :isit),
s(:int, 42))), s(:int, 42))),
s(:if_false, [s(:assign, s(:if_false, [s(:assign,
s(:name, "maybenot"), s(:name, :maybenot),
s(:int, 667))]))))]) s(:int, 667))])))))

View File

@ -2,8 +2,9 @@ int foo()
5 5
end end
-- -- -- -- -- --
s(:list, [s(:function, :int, s(:expressions,
s(:name, "foo"), s(:function, :int,
s(:name, :foo),
s(:parameters), s(:parameters),
s(:expressions, s(:expressions,
s(:int, 5)))]) s(:int, 5))))

View File

@ -3,15 +3,16 @@ int foo(int x)
abba + 5 abba + 5
end end
-- -- -- -- -- --
s(:list, [s(:function, :int, s(:expressions,
s(:name, "foo"), s(:function, :int,
s(:name, :foo),
s(:parameters, s(:parameters,
s(:field, :int, :x)), s(:field, :int, :x)),
s(:expressions, s(:expressions,
s(:name, "int"), s(:name, :int),
s(:assign, s(:assign,
s(:name, "abba"), s(:name, :abba),
s(:int, 5)), s(:int, 5)),
s(:operator, "+", s(:operator, "+",
s(:name, "abba"), s(:name, :abba),
s(:int, 5))))]) s(:int, 5)))))

View File

@ -3,14 +3,15 @@ int retvar(ref n)
return i return i
end end
-- -- -- -- -- --
s(:list, [s(:function, :int, s(:expressions,
s(:name, "retvar"), s(:function, :int,
s(:name, :retvar),
s(:parameters, s(:parameters,
s(:field, :ref, :n)), s(:field, :ref, :n)),
s(:expressions, s(:expressions,
s(:name, "int"), s(:name, :int),
s(:assign, s(:assign,
s(:name, "i"), s(:name, :i),
s(:int, 5)), s(:int, 5)),
s(:return, s(:return,
s(:name, "i"))))]) s(:name, :i)))))

View File

@ -6,18 +6,19 @@ int retvar(int n)
end end
end end
-- -- -- -- -- --
s(:list, [s(:function, :int, s(:expressions,
s(:name, "retvar"), s(:function, :int,
s(:name, :retvar),
s(:parameters, s(:parameters,
s(:field, :int, :n)), s(:field, :int, :n)),
s(:expressions, s(:expressions,
s(:if, s(:if,
s(:condition, s(:condition,
s(:operator, ">", s(:operator, ">",
s(:name, "n"), s(:name, :n),
s(:int, 5))), s(:int, 5))),
s(:if_true, s(:if_true,
s(:return, s(:return,
s(:int, 10))), s(:int, 10))),
s(:if_false, [s(:return, s(:if_false, [s(:return,
s(:int, 20))]))))]) s(:int, 20))])))))

View File

@ -5,21 +5,22 @@ int retvar(int n )
end end
end end
-- -- -- -- -- --
s(:list, [s(:function, :int, s(:expressions,
s(:name, "retvar"), s(:function, :int,
s(:name, :retvar),
s(:parameters, s(:parameters,
s(:field, :int, :n)), s(:field, :int, :n)),
s(:expressions, s(:expressions,
s(:while, s(:while,
s(:condition, s(:condition,
s(:operator, ">", s(:operator, ">",
s(:name, "n"), s(:name, :n),
s(:int, 5))), s(:int, 5))),
s(:expressions, s(:expressions,
s(:assign, s(:assign,
s(:name, "n"), s(:name, :n),
s(:operator, "+", s(:operator, "+",
s(:name, "n"), s(:name, :n),
s(:int, 1))), s(:int, 1))),
s(:return, s(:return,
s(:name, "n"))))))]) s(:name, :n)))))))

View File

@ -2,10 +2,11 @@ int foo( int n ,ref m)
n n
end end
-- -- -- -- -- --
s(:list, [s(:function, :int, s(:expressions,
s(:name, "foo"), s(:function, :int,
s(:name, :foo),
s(:parameters, s(:parameters,
s(:field, :int, :n), s(:field, :int, :n),
s(:field, :ref, :m)), s(:field, :ref, :m)),
s(:expressions, s(:expressions,
s(:name, "n")))]) s(:name, :n))))

View File

@ -6,23 +6,24 @@ ref fibonaccit(int n)
end end
end end
-- -- -- -- -- --
s(:list, [s(:function, :ref, s(:expressions,
s(:name, "fibonaccit"), s(:function, :ref,
s(:name, :fibonaccit),
s(:parameters, s(:parameters,
s(:field, :int, :n)), s(:field, :int, :n)),
s(:expressions, s(:expressions,
s(:assign, s(:assign,
s(:name, "a"), s(:name, :a),
s(:int, 0)), s(:int, 0)),
s(:while, s(:while,
s(:condition, s(:condition,
s(:name, "n")), s(:name, :n)),
s(:expressions, s(:expressions,
s(:assign, s(:assign,
s(:name, "some"), s(:name, :some),
s(:int, 43)), s(:int, 43)),
s(:assign, s(:assign,
s(:name, "other"), s(:name, :other),
s(:operator, "*", s(:operator, "*",
s(:name, "some"), s(:name, :some),
s(:int, 4)))))))]) s(:int, 4))))))))

View File

@ -2,9 +2,10 @@ int foo(ref x)
5 5
end end
-- -- -- -- -- --
s(:list, [s(:function, :int, s(:expressions,
s(:name, "foo"), s(:function, :int,
s(:name, :foo),
s(:parameters, s(:parameters,
s(:field, :ref, :x)), s(:field, :ref, :x)),
s(:expressions, s(:expressions,
s(:int, 5)))]) s(:int, 5))))

View File

@ -2,6 +2,8 @@ module Opers
abba = 5 abba = 5
end end
-- -- -- -- -- --
s(:list, [s(:module, "Opers", [s(:assign, s(:expressions,
s(:name, "abba"), s(:module, :Opers,
s(:int, 5))])]) s(:assign,
s(:name, :abba),
s(:int, 5))))

View File

@ -4,8 +4,12 @@ module Foo
end end
end end
-- -- -- -- -- --
s(:list, [s(:module, "Foo", [s(:class, "Bar", nil, [s(:call, s(:expressions,
s(:name, "funcall"), s(:module, :Foo,
s(:class, :Bar,
s(:derives, nil),
s(:call,
s(:name, :funcall),
s(:arguments, s(:arguments,
s(:int, 3), s(:int, 3),
s(:name, "var")))])])]) s(:name, :var))))))

View File

@ -5,15 +5,18 @@ module Soho
end end
end end
-- -- -- -- -- --
s(:list, [s(:module, "Soho", [s(:call, s(:expressions,
s(:name, "ofthen"), s(:module, :Soho,
s(:call,
s(:name, :ofthen),
s(:arguments, s(:arguments,
s(:int, 3), s(:int, 3),
s(:name, "var"))), s(:function, :int, s(:name, :var))),
s(:name, "ofthen"), s(:function, :int,
s(:name, :ofthen),
s(:parameters, s(:parameters,
s(:field, :int, :n), s(:field, :int, :n),
s(:field, :ref, :m)), s(:field, :ref, :m)),
s(:expressions, s(:expressions,
s(:return, s(:return,
s(:int, 44))))])]) s(:int, 44))))))

View File

@ -8,8 +8,10 @@ module Foo
end end
end end
-- -- -- -- -- --
s(:list, [s(:module, "Foo", [s(:function, :ref, s(:expressions,
s(:name, "ofthen"), s(:module, :Foo,
s(:function, :ref,
s(:name, :ofthen),
s(:parameters, s(:parameters,
s(:field, :int, :n)), s(:field, :int, :n)),
s(:expressions, s(:expressions,
@ -18,8 +20,8 @@ s(:list, [s(:module, "Foo", [s(:function, :ref,
s(:int, 0)), s(:int, 0)),
s(:if_true, s(:if_true,
s(:assign, s(:assign,
s(:name, "isit"), s(:name, :isit),
s(:int, 42))), s(:int, 42))),
s(:if_false, [s(:assign, s(:if_false, [s(:assign,
s(:name, "maybenot"), s(:name, :maybenot),
s(:int, 667))]))))])]) s(:int, 667))]))))))

View File

@ -5,16 +5,18 @@ module Opers
end end
end end
-- -- -- -- -- --
s(:list, [s(:module, "Opers", [s(:function, :int, s(:expressions,
s(:name, "foo"), s(:module, :Opers,
s(:function, :int,
s(:name, :foo),
s(:parameters, s(:parameters,
s(:field, :int, :x)), s(:field, :int, :x)),
s(:expressions, s(:expressions,
s(:name, "int"), s(:name, :int),
s(:assign, s(:assign,
s(:name, "abba"), s(:name, :abba),
s(:int, 5)), s(:int, 5)),
s(:return, s(:return,
s(:operator, "+", s(:operator, "+",
s(:name, "abba"), s(:name, :abba),
s(:int, 5)))))])]) s(:int, 5)))))))

View File

@ -2,4 +2,6 @@ module Simple
5 5
end end
-- -- -- -- -- --
s(:list, [s(:module, "Simple", [s(:int, 5)])]) s(:expressions,
s(:module, :Simple,
s(:int, 5)))

View File

@ -1,4 +1,5 @@
return 42 return 42
-- -- -- -- -- --
s(:list, [s(:return, s(:expressions,
s(:int, 42))]) s(:return,
s(:int, 42)))

View File

@ -1,4 +1,5 @@
return "hello" return "hello"
-- -- -- -- -- --
s(:list, [s(:return, s(:expressions,
s(:string, "hello"))]) s(:return,
s(:string, "hello")))

View File

@ -1,4 +1,5 @@
return foo return foo
-- -- -- -- -- --
s(:list, [s(:return, s(:expressions,
s(:name, "foo"))]) s(:return,
s(:name, :foo)))

View File

@ -3,9 +3,12 @@ class FooBo
end end
-- -- -- -- -- --
s(:list, [s(:class, "FooBo", nil, [s(:call, s(:expressions,
s(:name, "call"), s(:class, :FooBo,
s(:derives, nil),
s(:call,
s(:name, :call),
s(:arguments, s(:arguments,
s(:int, 35)), s(:int, 35)),
s(:receiver, s(:receiver,
s(:module, "Bar")))])]) s(:module, "Bar")))))

View File

@ -4,14 +4,16 @@ end
foo( 3 ) foo( 3 )
-- -- -- -- -- --
s(:list, [s(:function, :int, s(:expressions,
s(:name, "foo"), s(:function, :int,
s(:name, :foo),
s(:parameters, s(:parameters,
s(:field, :ref, :x)), s(:field, :ref, :x)),
s(:expressions, s(:expressions,
s(:assign, s(:assign,
s(:name, "a"), s(:name, :a),
s(:int, 5)))), s(:call, s(:int, 5)))),
s(:name, "foo"), s(:call,
s(:name, :foo),
s(:arguments, s(:arguments,
s(:int, 3)))]) s(:int, 3))))

View File

@ -12,43 +12,45 @@ end
fibonaccit( 10 ) fibonaccit( 10 )
-- -- -- -- -- --
s(:list, [s(:function, :int, s(:expressions,
s(:name, "fibonaccit"), s(:function, :int,
s(:name, :fibonaccit),
s(:parameters, s(:parameters,
s(:field, :int, :n)), s(:field, :int, :n)),
s(:expressions, s(:expressions,
s(:assign, s(:assign,
s(:name, "a"), s(:name, :a),
s(:int, 0)), s(:int, 0)),
s(:assign, s(:assign,
s(:name, "b"), s(:name, :b),
s(:int, 1)), s(:int, 1)),
s(:while, s(:while,
s(:condition, s(:condition,
s(:operator, ">", s(:operator, ">",
s(:name, "n"), s(:name, :n),
s(:int, 1))), s(:int, 1))),
s(:expressions, s(:expressions,
s(:assign, s(:assign,
s(:name, "tmp"), s(:name, :tmp),
s(:name, "a")), s(:name, :a)),
s(:assign, s(:assign,
s(:name, "a"), s(:name, :a),
s(:name, "b")), s(:name, :b)),
s(:assign, s(:assign,
s(:name, "b"), s(:name, :b),
s(:operator, "+", s(:operator, "+",
s(:name, "tmp"), s(:name, :tmp),
s(:name, "b"))), s(:name, :b))),
s(:call, s(:call,
s(:name, "puts"), s(:name, :puts),
s(:arguments, s(:arguments,
s(:name, "b"))), s(:name, :b))),
s(:assign, s(:assign,
s(:name, "n"), s(:name, :n),
s(:operator, "-", s(:operator, "-",
s(:name, "n"), s(:name, :n),
s(:int, 1))))))), s(:call, s(:int, 1))))))),
s(:name, "fibonaccit"), s(:call,
s(:name, :fibonaccit),
s(:arguments, s(:arguments,
s(:int, 10)))]) s(:int, 10))))

View File

@ -4,13 +4,16 @@ module Fibo
end end
-- -- -- -- -- --
s(:list, [s(:module, "Fibo", [s(:assign, s(:expressions,
s(:name, "a"), s(:module, :Fibo,
s(:assign,
s(:name, :a),
s(:operator, "+", s(:operator, "+",
s(:int, 5), s(:int, 5),
s(:name, "foo"))), s(:call, s(:name, :foo))),
s(:name, "bar"), s(:call,
s(:name, :bar),
s(:arguments, s(:arguments,
s(:name, "b"), s(:name, :b),
s(:name, "a"), s(:name, :a),
s(:name, "r")))])]) s(:name, :r)))))

View File

@ -8,17 +8,20 @@ module Fibo
end end
-- -- -- -- -- --
s(:list, [s(:module, "Fibo", [s(:function, :int, s(:expressions,
s(:name, "fibonaccit"), s(:module, :Fibo,
s(:function, :int,
s(:name, :fibonaccit),
s(:parameters, s(:parameters,
s(:field, :int, :n)), s(:field, :int, :n)),
s(:expressions, s(:expressions,
s(:name, "int"), s(:name, :int),
s(:assign, s(:assign,
s(:name, "a"), s(:name, :a),
s(:int, 0)), s(:int, 0)),
s(:return, s(:return,
s(:name, "a")))), s(:call, s(:name, :a)))),
s(:name, "fibonaccit"), s(:call,
s(:name, :fibonaccit),
s(:arguments, s(:arguments,
s(:int, 10)))])]) s(:int, 10)))))

View File

@ -5,8 +5,12 @@ module FooBo
end end
-- -- -- -- -- --
s(:list, [s(:module, "FooBo", [s(:class, "Bar", nil, [s(:assign, s(:expressions,
s(:name, "a"), s(:module, :FooBo,
s(:class, :Bar,
s(:derives, nil),
s(:assign,
s(:name, :a),
s(:operator, "+", s(:operator, "+",
s(:int, 5), s(:int, 5),
s(:name, "foo")))])])]) s(:name, :foo))))))

View File

@ -6,29 +6,30 @@ while( n > 1)
n = n - 1 n = n - 1
end end
-- -- -- -- -- --
s(:list, [s(:while, s(:expressions,
s(:while,
s(:condition, s(:condition,
s(:operator, ">", s(:operator, ">",
s(:name, "n"), s(:name, :n),
s(:int, 1))), s(:int, 1))),
s(:expressions, s(:expressions,
s(:assign, s(:assign,
s(:name, "tmp"), s(:name, :tmp),
s(:name, "a")), s(:name, :a)),
s(:assign, s(:assign,
s(:name, "a"), s(:name, :a),
s(:name, "b")), s(:name, :b)),
s(:assign, s(:assign,
s(:name, "b"), s(:name, :b),
s(:operator, "+", s(:operator, "+",
s(:name, "tmp"), s(:name, :tmp),
s(:name, "b"))), s(:name, :b))),
s(:call, s(:call,
s(:name, "puts"), s(:name, :puts),
s(:arguments, s(:arguments,
s(:name, "b"))), s(:name, :b))),
s(:assign, s(:assign,
s(:name, "n"), s(:name, :n),
s(:operator, "-", s(:operator, "-",
s(:name, "n"), s(:name, :n),
s(:int, 1)))))]) s(:int, 1))))))

View File

@ -3,14 +3,15 @@ while(1)
puts(b) puts(b)
end end
-- -- -- -- -- --
s(:list, [s(:while, s(:expressions,
s(:while,
s(:condition, s(:condition,
s(:int, 1)), s(:int, 1)),
s(:expressions, s(:expressions,
s(:assign, s(:assign,
s(:name, "tmp"), s(:name, :tmp),
s(:name, "a")), s(:name, :a)),
s(:call, s(:call,
s(:name, "puts"), s(:name, :puts),
s(:arguments, s(:arguments,
s(:name, "b")))))]) s(:name, :b))))))

View File

@ -3,20 +3,21 @@ while(1)
tmp.puts(i) tmp.puts(i)
end end
-- -- -- -- -- --
s(:list, [s(:while, s(:expressions,
s(:while,
s(:condition, s(:condition,
s(:int, 1)), s(:int, 1)),
s(:expressions, s(:expressions,
s(:assign, s(:assign,
s(:name, "tmp"), s(:name, :tmp),
s(:call, s(:call,
s(:name, "new"), s(:name, :new),
s(:arguments), s(:arguments),
s(:receiver, s(:receiver,
s(:module, "String")))), s(:module, "String")))),
s(:call, s(:call,
s(:name, "puts"), s(:name, :puts),
s(:arguments, s(:arguments,
s(:name, "i")), s(:name, :i)),
s(:receiver, s(:receiver,
s(:name, "tmp")))))]) s(:name, :tmp))))))