Permalink
Browse files

First import

git-svn-id: http://hotruby.googlecode.com/svn/trunk@2 4fb8041d-b042-0410-9571-f50be27af959
  • Loading branch information...
1 parent c70e71a commit d8907474082ca26a349375f6c401c2e311ee48a6 yukoba@accelart.jp committed Jan 1, 2008
Showing with 6,196 additions and 0 deletions.
  1. +11 −0 .project
  2. +1 −0 test/FileLineNo/fileLineNo.json
  3. +2 −0 test/FileLineNo/fileLineNo.rb
  4. +1 −0 test/aryArg/aryArg.json
  5. +4 −0 test/aryArg/aryArg.rb
  6. +131 −0 test/aryArg/aryArg_pretty.json
  7. +1 −0 test/basic/t.json
  8. +9 −0 test/basic/t.rb
  9. +187 −0 test/basic/t2.json
  10. +1 −0 test/block/block.json
  11. +18 −0 test/block/block.rb
  12. +18 −0 test/block/block2.rb
  13. +344 −0 test/block/block_pretty.json
  14. +1 −0 test/bm_loop_times/bm_loop_times.json
  15. +7 −0 test/bm_loop_times/bm_loop_times.rb
  16. +253 −0 test/bm_loop_times/bm_loop_times_pretty.json
  17. +8 −0 test/bm_loop_times/bugcheck.rb
  18. +1 −0 test/cbase/cbase.json
  19. +12 −0 test/cbase/cbase.rb
  20. +223 −0 test/cbase/cbase_pretty.json
  21. +1 −0 test/class/class.json
  22. +14 −0 test/class/class.rb
  23. +227 −0 test/class/class2.json
  24. +2 −0 test/compile.bat
  25. +51 −0 test/compile.rb
  26. +1 −0 test/const/const.json
  27. +39 −0 test/const/const.rb
  28. +12 −0 test/const/test2.rb
  29. +142 −0 test/def/defetst2.json
  30. +1 −0 test/def/deftest.json
  31. +7 −0 test/def/deftest.rb
  32. +1 −0 test/defDef/defDef.json
  33. +9 −0 test/defDef/defDef.rb
  34. +148 −0 test/defDef/defDef2.json
  35. +1 −0 test/endBlock/endBlock.json
  36. +4 −0 test/endBlock/endBlock.rb
  37. +237 −0 test/endBlock/endBlock_pretty.json
  38. +1 −0 test/hash/hash.json
  39. +7 −0 test/hash/hash.rb
  40. +229 −0 test/hash/hash_pretty.json
  41. +1 −0 test/insertSort/insertSort.json
  42. +26 −0 test/insertSort/insertSort.rb
  43. +626 −0 test/insertSort/insertSort_pretty.json
  44. +1 −0 test/plus/plustest.json
  45. +3 −0 test/plus/plustest.rb
  46. +67 −0 test/plus/plustest2.json
  47. +1 −0 test/protected/protected.json
  48. +8 −0 test/protected/protected.rb
  49. +158 −0 test/protected/protected_pretty.json
  50. +1 −0 test/range2/range2.json
  51. +11 −0 test/range2/range2.rb
  52. +282 −0 test/range2/range2_pretty.json
  53. +4 −0 test/readme.txt
  54. +1 −0 test/specialVars/specialVars.json
  55. +1 −0 test/specialVars/specialVars.rb
  56. +1 −0 test/super/super.json
  57. +19 −0 test/super/super.rb
  58. +382 −0 test/super/super2.json
  59. +1 −0 test/time/time.json
  60. +2 −0 test/time/time.rb
  61. +62 −0 test/time/time_pretty.json
  62. +4 −0 web/buildJSDoc.bat
  63. +20 −0 web/compileRuby.cgi
  64. +20 −0 web/compileRuby_cgi
  65. +2 −0 web/css/prettify.css
  66. +57 −0 web/index.html
  67. +782 −0 web/js/HotRuby.js
  68. +401 −0 web/js/NativeMethods.js
  69. +10 −0 web/js/ext-base.js
  70. +18 −0 web/js/prettify.js
  71. +1 −0 web/js/test/AryArgs.js
  72. +1 −0 web/js/test/Block.js
  73. +1 −0 web/js/test/Cbase.js
  74. +1 −0 web/js/test/Class.js
  75. +1 −0 web/js/test/Const.js
  76. +1 −0 web/js/test/Def.js
  77. +1 −0 web/js/test/DefDef.js
  78. +1 −0 web/js/test/EndBlock.js
  79. +1 −0 web/js/test/Hash.js
  80. +1 −0 web/js/test/InsertionSort.js
  81. +1 −0 web/js/test/Plus.js
  82. +1 −0 web/js/test/Super.js
  83. +1 −0 web/js/test/Time.js
  84. +1 −0 web/js/test/bm_loop_times.js
  85. +10 −0 web/test-local/aryArgs.html
  86. +10 −0 web/test-local/block.html
  87. +12 −0 web/test-local/bm_loop_times.html
  88. +10 −0 web/test-local/cbase.html
  89. +10 −0 web/test-local/class.html
  90. +10 −0 web/test-local/const.html
  91. +10 −0 web/test-local/def.html
  92. +10 −0 web/test-local/defdef.html
  93. +10 −0 web/test-local/endBlock.html
  94. +10 −0 web/test-local/hash.html
  95. +12 −0 web/test-local/insertionSort.html
  96. +10 −0 web/test-local/plus.html
  97. +10 −0 web/test-local/super.html
  98. +10 −0 web/test-local/time.html
  99. +33 −0 web/test-web/aryArgs.html
  100. +59 −0 web/test-web/block.html
  101. +47 −0 web/test-web/bm_loop_times.html
  102. +45 −0 web/test-web/cbase.html
  103. +51 −0 web/test-web/class.html
  104. +99 −0 web/test-web/const.html
  105. +35 −0 web/test-web/def.html
  106. +45 −0 web/test-web/defdef.html
  107. +83 −0 web/test-web/diy.html
  108. +31 −0 web/test-web/endBlock.html
  109. +35 −0 web/test-web/hash.html
  110. +73 −0 web/test-web/insertionSort.html
  111. +63 −0 web/test-web/super.html
View
11 .project
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>HotRuby</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
View
1 test/FileLineNo/fileLineNo.json
@@ -0,0 +1 @@
+["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":2},"<main>","fileLineNo\\fileLineNo.rb","top",[],0,[],[1,["putnil"],["putstring","fileLineNo\\fileLineNo.rb"],["send","puts",1,null,8,null],["pop"],2,["putnil"],["putobject",2],["send","puts",1,null,8,null],["leave"]]]
View
2 test/FileLineNo/fileLineNo.rb
@@ -0,0 +1,2 @@
+puts __FILE__
+puts __LINE__
View
1 test/aryArg/aryArg.json
@@ -0,0 +1 @@
+["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":4},"<main>","aryArg\\aryArg.rb","top",[],0,[],[1,["putnil"],["definemethod","test",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":3,"local_size":4,"stack_max":3},"test","aryArg\\aryArg.rb","method",["a","b","c"],3,[],[2,["putnil"],["getlocal",4],["getlocal",3],["send","+",1,null,0,null],["getlocal",2],["send","+",1,null,0,null],["send","puts",1,null,8,null],["leave"]]],0],4,["putnil"],["putstring","Hello"],["putstring"," "],["putstring","World!"],["newarray",2],["send","test",2,null,10,null],["leave"]]]
View
4 test/aryArg/aryArg.rb
@@ -0,0 +1,4 @@
+def test a, b, c
+ puts a + b + c
+end
+test "Hello", *[" ", "World!"]
View
131 test/aryArg/aryArg_pretty.json
@@ -0,0 +1,131 @@
+[
+ "YARVInstructionSequence\/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size": 0,
+ "local_size": 1,
+ "stack_max": 4
+ },
+ "<main>",
+ "aryArg\\aryArg.rb",
+ "top",
+ [
+
+ ],
+ 0,
+ [
+
+ ],
+ [
+ 1,
+ [
+ "putnil"
+ ],
+ [
+ "definemethod",
+ "test",
+ [
+ "YARVInstructionSequence\/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size": 3,
+ "local_size": 4,
+ "stack_max": 3
+ },
+ "test",
+ "aryArg\\aryArg.rb",
+ "method",
+ [
+ "a",
+ "b",
+ "c"
+ ],
+ 3,
+ [
+
+ ],
+ [
+ 2,
+ [
+ "putnil"
+ ],
+ [
+ "getlocal",
+ 4
+ ],
+ [
+ "getlocal",
+ 3
+ ],
+ [
+ "send",
+ "+",
+ 1,
+ null,
+ 0,
+ null
+ ],
+ [
+ "getlocal",
+ 2
+ ],
+ [
+ "send",
+ "+",
+ 1,
+ null,
+ 0,
+ null
+ ],
+ [
+ "send",
+ "puts",
+ 1,
+ null,
+ 8,
+ null
+ ],
+ [
+ "leave"
+ ]
+ ]
+ ],
+ 0
+ ],
+ 4,
+ [
+ "putnil"
+ ],
+ [
+ "putstring",
+ "Hello"
+ ],
+ [
+ "putstring",
+ " "
+ ],
+ [
+ "putstring",
+ "World!"
+ ],
+ [
+ "newarray",
+ 2
+ ],
+ [
+ "send",
+ "test",
+ 2,
+ null,
+ 10,
+ null
+ ],
+ [
+ "leave"
+ ]
+ ]
+]
View
1 test/basic/t.json
@@ -0,0 +1 @@
+["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":2},"<main>","t.rb","top",[],0,[],[1,["putnil"],["putnil"],["defineclass","C",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":1},"<class:C>","t.rb","class",[],0,[],[2,["putnil"],["definemethod","m",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":1},"m","t.rb","method",[],0,[["break",null,"label_0","label_8","label_8",0]],["label_0",3,["putobject",1],["send","times",0,["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":0,"stack_max":2},"block in m","t.rb","block",[],0,[["redo",null,"label_0","label_9","label_0",0],["next",null,"label_0","label_9","label_9",0]],["label_0",4,["putnil"],["putstring","Hello"],["send","print",1,null,8,null],"label_9",["leave"]]],0,null],"label_8",["leave"]]],0],["putnil"],["leave"]]],0],["pop"],9,["putnil"],["getconstant","C"],["send","new",0,null,0,null],["send","m",0,null,0,null],["leave"]]]
View
9 test/basic/t.rb
@@ -0,0 +1,9 @@
+class C
+ def m
+ 1.times{
+ print("Hello");
+ }
+ end
+end
+
+C.new.m
View
187 test/basic/t2.json
@@ -0,0 +1,187 @@
+[
+ "YARVInstructionSequence/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size" : 0,
+ "local_size" : 1,
+ "stack_max" : 2
+ },
+ "<main>",
+ "t.rb",
+ "top",
+ [],
+ 0,
+ [],
+ [
+ 1,
+ [
+ "putnil"
+ ],
+ [
+ "putnil"
+ ],
+ [
+ "defineclass",
+ "C",
+ [
+ "YARVInstructionSequence/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size" : 0,
+ "local_size" : 1,
+ "stack_max" : 1
+ },
+ "<class:C>",
+ "t.rb",
+ "class",
+ [],
+ 0,
+ [],
+ [
+ 2,
+ [
+ "putnil"
+ ],
+ [
+ "definemethod",
+ "m",
+ [
+ "YARVInstructionSequence/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size" : 0,
+ "local_size" : 1,
+ "stack_max" : 1
+ },
+ "m",
+ "t.rb",
+ "method",
+ [],
+ 0,
+ [
+ [
+ "break",
+ "label_0",
+ "label_8",
+ "label_8",
+ 0
+ ]
+ ],
+ [
+ "label_0",
+ 3,
+ [
+ "putobject",
+ 1
+ ],
+ [
+ "send",
+ "times",
+ 0,
+ [
+ "YARVInstructionSequence/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size" : 0,
+ "local_size" : 0,
+ "stack_max" : 2
+ },
+ "block in m",
+ "t.rb",
+ "block",
+ [],
+ 0,
+ [
+ [
+ "redo",
+ "label_0",
+ "label_9",
+ "label_0",
+ 0
+ ],
+ [
+ "next",
+ "label_0",
+ "label_9",
+ "label_9",
+ 0
+ ]
+ ],
+ [
+ "label_0",
+ 4,
+ [
+ "putnil"
+ ],
+ [
+ "putstring",
+ "Hello"
+ ],
+ [
+ "send",
+ "print",
+ 1,
+ 8
+ ],
+ "label_9",
+ [
+ "leave"
+ ]
+ ]
+ ],
+ 0
+ ],
+ "label_8",
+ [
+ "leave"
+ ]
+ ]
+ ],
+ 0
+ ],
+ [
+ "putnil"
+ ],
+ [
+ "leave"
+ ]
+ ]
+ ],
+ 0
+ ],
+ [
+ "pop"
+ ],
+ 9,
+ [
+ "putnil"
+ ],
+ [
+ "getconstant",
+ "C"
+ ],
+ [
+ "send",
+ "new",
+ 0,
+ 0
+ ],
+ [
+ "send",
+ "m",
+ 0,
+ 0
+ ],
+ [
+ "leave"
+ ]
+ ]
+]
View
1 test/block/block.json
@@ -0,0 +1 @@
+["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":2},"<main>","block\\block.rb","top",[],0,[],[1,["putnil"],["putnil"],["defineclass","Hoge",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":1},"<class:Hoge>","block\\block.rb","class",[],0,[],[2,["putnil"],["definemethod","add_msg",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":1,"local_size":2,"stack_max":2},"add_msg","block\\block.rb","method",["block"],[0,[],0,0,-1,0,0],[],[3,["getlocal",2],["putstring","World"],["send","yield",1,null,0,null],["leave"]]],0],["putnil"],["leave"]]],0],["pop"],7,["putnil"],["putnil"],["defineclass","Foo",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":1},"<class:Foo>","block\\block.rb","class",[],0,[],[8,["putnil"],["definemethod","main",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":2,"stack_max":1},"main","block\\block.rb","method",["pre"],0,[["break",null,"label_8","label_23","label_23",0]],[9,["putstring","Hello"],["setlocal",2],10,["putstring"," "],["setinstancevariable","@space"],"label_8",11,["putnil"],["getconstant","Hoge"],["send","new",0,null,0,null],["send","add_msg",0,["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":1,"local_size":2,"stack_max":3},"block in main","block\\block.rb","block",["msg","fuga"],[1,[],0,0,-1,-1,3],[["redo",null,"label_0","label_41","label_0",0],["next",null,"label_0","label_41","label_41",0]],["label_0",12,["putstring","!"],["setdynamic",1,0],13,["putnil"],["getdynamic",2,1],["getinstancevariable","@space"],["send","+",1,null,0,null],["getdynamic",2,0],["send","+",1,null,0,null],["getdynamic",1,0],["send","+",1,null,0,null],["send","puts",1,null,8,null],"label_41",["leave"]]],0,null],"label_23",["leave"]]],0],["putnil"],["leave"]]],0],["pop"],18,["putnil"],["getconstant","Foo"],["send","new",0,null,0,null],["send","main",0,null,0,null],["leave"]]]
View
18 test/block/block.rb
@@ -0,0 +1,18 @@
+class Hoge
+ def add_msg &block
+ block.yield "World"
+ end
+end
+
+class Foo
+ def main
+ pre = "Hello"
+ @space = " "
+ Hoge.new.add_msg do |msg|
+ fuga = "!"
+ puts pre + @space + msg + fuga
+ end
+ end
+end
+
+Foo.new.main
View
18 test/block/block2.rb
@@ -0,0 +1,18 @@
+class Hoge
+ def add_msg &block
+ block.yield "World"
+ end
+end
+
+def main
+ pre = "Hello"
+ block2 = new Proc(do
+ space = " "
+ Hoge.new.add_msg do |msg|
+ fuga = "!"
+ puts pre + space + msg + fuga
+ end
+ end)
+end
+
+main
View
344 test/block/block_pretty.json
@@ -0,0 +1,344 @@
+[
+ "YARVInstructionSequence/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size" : 0,
+ "local_size" : 1,
+ "stack_max" : 2
+ },
+ "<main>",
+ "block\\block.rb",
+ "top",
+ [],
+ 0,
+ [],
+ [
+ 1,
+ [
+ "putnil"
+ ],
+ [
+ "putnil"
+ ],
+ [
+ "defineclass",
+ "Hoge",
+ [
+ "YARVInstructionSequence/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size" : 0,
+ "local_size" : 1,
+ "stack_max" : 1
+ },
+ "<class:Hoge>",
+ "block\\block.rb",
+ "class",
+ [],
+ 0,
+ [],
+ [
+ 2,
+ [
+ "putnil"
+ ],
+ [
+ "definemethod",
+ "addWorld",
+ [
+ "YARVInstructionSequence/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size" : 1,
+ "local_size" : 2,
+ "stack_max" : 2
+ },
+ "addWorld",
+ "block\\block.rb",
+ "method",
+ [
+ "block"
+ ],
+ [
+ 0,
+ [],
+ 0,
+ 0,
+ -1,
+ 0,
+ 0
+ ],
+ [],
+ [
+ 3,
+ [
+ "getlocal",
+ 2
+ ],
+ [
+ "putstring",
+ "World"
+ ],
+ [
+ "send",
+ "yield",
+ 1,
+ 0
+ ],
+ [
+ "leave"
+ ]
+ ]
+ ],
+ 0
+ ],
+ [
+ "putnil"
+ ],
+ [
+ "leave"
+ ]
+ ]
+ ],
+ 0
+ ],
+ [
+ "pop"
+ ],
+ 7,
+ [
+ "putnil"
+ ],
+ [
+ "putnil"
+ ],
+ [
+ "defineclass",
+ "Foo",
+ [
+ "YARVInstructionSequence/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size" : 0,
+ "local_size" : 1,
+ "stack_max" : 1
+ },
+ "<class:Foo>",
+ "block\\block.rb",
+ "class",
+ [],
+ 0,
+ [],
+ [
+ 8,
+ [
+ "putnil"
+ ],
+ [
+ "definemethod",
+ "main",
+ [
+ "YARVInstructionSequence/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size" : 0,
+ "local_size" : 2,
+ "stack_max" : 1
+ },
+ "main",
+ "block\\block.rb",
+ "method",
+ [
+ "pre"
+ ],
+ 0,
+ [
+ [
+ "break",
+ "label_8",
+ "label_23",
+ "label_23",
+ 0
+ ]
+ ],
+ [
+ 9,
+ [
+ "putstring",
+ "Hello"
+ ],
+ [
+ "setlocal",
+ 2
+ ],
+ 10,
+ [
+ "putstring",
+ " "
+ ],
+ [
+ "setinstancevariable",
+ "@space"
+ ],
+ "label_8",
+ 11,
+ [
+ "putnil"
+ ],
+ [
+ "getconstant",
+ "Hoge"
+ ],
+ [
+ "send",
+ "new",
+ 0,
+ 0
+ ],
+ [
+ "send",
+ "addWorld",
+ 0,
+ [
+ "YARVInstructionSequence/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size" : 1,
+ "local_size" : 1,
+ "stack_max" : 3
+ },
+ "block in main",
+ "block\\block.rb",
+ "block",
+ [
+ "msg"
+ ],
+ [
+ 1,
+ [],
+ 0,
+ 0,
+ -1,
+ -1,
+ 3
+ ],
+ [
+ [
+ "redo",
+ "label_0",
+ "label_27",
+ "label_0",
+ 0
+ ],
+ [
+ "next",
+ "label_0",
+ "label_27",
+ "label_27",
+ 0
+ ]
+ ],
+ [
+ "label_0",
+ 12,
+ [
+ "putnil"
+ ],
+ [
+ "getdynamic",
+ 2,
+ 1
+ ],
+ [
+ "getinstancevariable",
+ "@space"
+ ],
+ [
+ "send",
+ "+",
+ 1,
+ 0
+ ],
+ [
+ "getdynamic",
+ 1,
+ 0
+ ],
+ [
+ "send",
+ "+",
+ 1,
+ 0
+ ],
+ [
+ "send",
+ "puts",
+ 1,
+ 8
+ ],
+ "label_27",
+ [
+ "leave"
+ ]
+ ]
+ ],
+ 0
+ ],
+ "label_23",
+ [
+ "leave"
+ ]
+ ]
+ ],
+ 0
+ ],
+ [
+ "putnil"
+ ],
+ [
+ "leave"
+ ]
+ ]
+ ],
+ 0
+ ],
+ [
+ "pop"
+ ],
+ 17,
+ [
+ "putnil"
+ ],
+ [
+ "getconstant",
+ "Foo"
+ ],
+ [
+ "send",
+ "new",
+ 0,
+ 0
+ ],
+ [
+ "send",
+ "main",
+ 0,
+ 0
+ ],
+ [
+ "leave"
+ ]
+ ]
+]
View
1 test/bm_loop_times/bm_loop_times.json
@@ -0,0 +1 @@
+["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":4,"stack_max":3},"<main>","bm_loop_times\\bm_loop_times.rb","top",["startTime","sum","endTime"],0,[["break",null,"label_21","label_29","label_29",0]],[1,["putnil"],["getconstant","Time"],["send","new",0,null,0,null],["send","to_f",0,null,0,null],["setlocal",4],3,["putstring",""],["setlocal",3],"label_21",4,["putobject",50000],["send","times",0,["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":1,"local_size":1,"stack_max":2},"block in <main>","bm_loop_times\\bm_loop_times.rb","block",["e"],[1,[],0,0,-1,-1,3],[["redo",null,"label_0","label_22","label_0",0],["next",null,"label_0","label_22","label_22",0]],["label_0",4,["getdynamic",3,1],["getdynamic",1,0],["send","to_s",0,null,0,null],["send","+",1,null,0,null],["dup"],["setdynamic",3,1],"label_22",["leave"]]],0,null],"label_29",["pop"],6,["putnil"],["getconstant","Time"],["send","new",0,null,0,null],["send","to_f",0,null,0,null],["setlocal",2],7,["putnil"],["getlocal",2],["getlocal",4],["send","-",1,null,0,null],["send","to_s",0,null,0,null],["putstring"," sec"],["send","+",1,null,0,null],["send","puts",1,null,8,null],["leave"]]]
View
7 test/bm_loop_times/bm_loop_times.rb
@@ -0,0 +1,7 @@
+startTime = Time.new.to_f
+
+sum = ""
+50000.times{|e| sum += e.to_s}
+
+endTime = Time.new.to_f
+puts (endTime - startTime).to_s + " sec"
View
253 test/bm_loop_times/bm_loop_times_pretty.json
@@ -0,0 +1,253 @@
+[
+ "YARVInstructionSequence\/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size": 0,
+ "local_size": 4,
+ "stack_max": 3
+ },
+ "<main>",
+ "bm_loop_times\\bm_loop_times.rb",
+ "top",
+ [
+ "startTime",
+ "sum",
+ "endTime"
+ ],
+ 0,
+ [
+ [
+ "break",
+ null,
+ "label_21",
+ "label_29",
+ "label_29",
+ 0
+ ]
+ ],
+ [
+ 1,
+ [
+ "putnil"
+ ],
+ [
+ "getconstant",
+ "Time"
+ ],
+ [
+ "send",
+ "new",
+ 0,
+ null,
+ 0,
+ null
+ ],
+ [
+ "send",
+ "to_f",
+ 0,
+ null,
+ 0,
+ null
+ ],
+ [
+ "setlocal",
+ 4
+ ],
+ 3,
+ [
+ "putstring",
+ ""
+ ],
+ [
+ "setlocal",
+ 3
+ ],
+ "label_21",
+ 4,
+ [
+ "putobject",
+ 50000
+ ],
+ [
+ "send",
+ "times",
+ 0,
+ [
+ "YARVInstructionSequence\/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size": 1,
+ "local_size": 1,
+ "stack_max": 2
+ },
+ "block in <main>",
+ "bm_loop_times\\bm_loop_times.rb",
+ "block",
+ [
+ "e"
+ ],
+ [
+ 1,
+ [
+
+ ],
+ 0,
+ 0,
+ -1,
+ -1,
+ 3
+ ],
+ [
+ [
+ "redo",
+ null,
+ "label_0",
+ "label_22",
+ "label_0",
+ 0
+ ],
+ [
+ "next",
+ null,
+ "label_0",
+ "label_22",
+ "label_22",
+ 0
+ ]
+ ],
+ [
+ "label_0",
+ 4,
+ [
+ "getdynamic",
+ 3,
+ 1
+ ],
+ [
+ "getdynamic",
+ 1,
+ 0
+ ],
+ [
+ "send",
+ "to_s",
+ 0,
+ null,
+ 0,
+ null
+ ],
+ [
+ "send",
+ "+",
+ 1,
+ null,
+ 0,
+ null
+ ],
+ [
+ "dup"
+ ],
+ [
+ "setdynamic",
+ 3,
+ 1
+ ],
+ "label_22",
+ [
+ "leave"
+ ]
+ ]
+ ],
+ 0,
+ null
+ ],
+ "label_29",
+ [
+ "pop"
+ ],
+ 6,
+ [
+ "putnil"
+ ],
+ [
+ "getconstant",
+ "Time"
+ ],
+ [
+ "send",
+ "new",
+ 0,
+ null,
+ 0,
+ null
+ ],
+ [
+ "send",
+ "to_f",
+ 0,
+ null,
+ 0,
+ null
+ ],
+ [
+ "setlocal",
+ 2
+ ],
+ 7,
+ [
+ "putnil"
+ ],
+ [
+ "getlocal",
+ 2
+ ],
+ [
+ "getlocal",
+ 4
+ ],
+ [
+ "send",
+ "-",
+ 1,
+ null,
+ 0,
+ null
+ ],
+ [
+ "send",
+ "to_s",
+ 0,
+ null,
+ 0,
+ null
+ ],
+ [
+ "putstring",
+ " sec"
+ ],
+ [
+ "send",
+ "+",
+ 1,
+ null,
+ 0,
+ null
+ ],
+ [
+ "send",
+ "puts",
+ 1,
+ null,
+ 8,
+ null
+ ],
+ [
+ "leave"
+ ]
+ ]
+]
View
8 test/bm_loop_times/bugcheck.rb
@@ -0,0 +1,8 @@
+startTime = Time.new.to_f
+
+sum = ""
+50000.times{|e| sum += e.to_s}
+
+endTime = Time.new.to_f
+t = (endTime - startTime).to_s
+puts t + ' sec'
View
1 test/cbase/cbase.json
@@ -0,0 +1 @@
+["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":2,"stack_max":2},"<main>","cbase\\cbase.rb","top",["obj"],0,[],[1,["putnil"],["getconstant","Object"],["send","new",0,null,0,null],["setlocal",2],2,["getlocal",2],["putnil"],["defineclass","singletonclass",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":1},"singletonclass","cbase\\cbase.rb","class",[],0,[],[3,["putnil"],["definemethod","test",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":2},"test","cbase\\cbase.rb","method",[],0,[],[4,["putnil"],["putstring","Hello World! 1"],["send","puts",1,null,8,null],["leave"]]],0],["putnil"],["leave"]]],1],["pop"],7,["getlocal",2],["send","test",0,null,0,null],["pop"],9,["getlocal",2],["definemethod","test",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":2},"test","cbase\\cbase.rb","method",[],0,[],[10,["putnil"],["putstring","Hello World! 2"],["send","puts",1,null,8,null],["leave"]]],1],12,["getlocal",2],["send","test",0,null,0,null],["leave"]]]
View
12 test/cbase/cbase.rb
@@ -0,0 +1,12 @@
+obj = Object.new
+class << obj
+ def test
+ puts "Hello World! 1"
+ end
+end
+obj.test
+
+def obj.test
+ puts "Hello World! 2"
+end
+obj.test
View
223 test/cbase/cbase_pretty.json
@@ -0,0 +1,223 @@
+[
+ "YARVInstructionSequence\/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size": 0,
+ "local_size": 2,
+ "stack_max": 2
+ },
+ "<main>",
+ "cbase\\cbase.rb",
+ "top",
+ [
+ "obj"
+ ],
+ 0,
+ [
+
+ ],
+ [
+ 1,
+ [
+ "putnil"
+ ],
+ [
+ "getconstant",
+ "Object"
+ ],
+ [
+ "send",
+ "new",
+ 0,
+ null,
+ 0,
+ null
+ ],
+ [
+ "setlocal",
+ 2
+ ],
+ 2,
+ [
+ "getlocal",
+ 2
+ ],
+ [
+ "putnil"
+ ],
+ [
+ "defineclass",
+ "singletonclass",
+ [
+ "YARVInstructionSequence\/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size": 0,
+ "local_size": 1,
+ "stack_max": 1
+ },
+ "singletonclass",
+ "cbase\\cbase.rb",
+ "class",
+ [
+
+ ],
+ 0,
+ [
+
+ ],
+ [
+ 3,
+ [
+ "putnil"
+ ],
+ [
+ "definemethod",
+ "test",
+ [
+ "YARVInstructionSequence\/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size": 0,
+ "local_size": 1,
+ "stack_max": 2
+ },
+ "test",
+ "cbase\\cbase.rb",
+ "method",
+ [
+
+ ],
+ 0,
+ [
+
+ ],
+ [
+ 4,
+ [
+ "putnil"
+ ],
+ [
+ "putstring",
+ "Hello World! 1"
+ ],
+ [
+ "send",
+ "puts",
+ 1,
+ null,
+ 8,
+ null
+ ],
+ [
+ "leave"
+ ]
+ ]
+ ],
+ 0
+ ],
+ [
+ "putnil"
+ ],
+ [
+ "leave"
+ ]
+ ]
+ ],
+ 1
+ ],
+ [
+ "pop"
+ ],
+ 7,
+ [
+ "getlocal",
+ 2
+ ],
+ [
+ "send",
+ "test",
+ 0,
+ null,
+ 0,
+ null
+ ],
+ [
+ "pop"
+ ],
+ 9,
+ [
+ "getlocal",
+ 2
+ ],
+ [
+ "definemethod",
+ "test",
+ [
+ "YARVInstructionSequence\/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size": 0,
+ "local_size": 1,
+ "stack_max": 2
+ },
+ "test",
+ "cbase\\cbase.rb",
+ "method",
+ [
+
+ ],
+ 0,
+ [
+
+ ],
+ [
+ 10,
+ [
+ "putnil"
+ ],
+ [
+ "putstring",
+ "Hello World! 2"
+ ],
+ [
+ "send",
+ "puts",
+ 1,
+ null,
+ 8,
+ null
+ ],
+ [
+ "leave"
+ ]
+ ]
+ ],
+ 1
+ ],
+ 12,
+ [
+ "getlocal",
+ 2
+ ],
+ [
+ "send",
+ "test",
+ 0,
+ null,
+ 0,
+ null
+ ],
+ [
+ "leave"
+ ]
+ ]
+]
View
1 test/class/class.json
@@ -0,0 +1 @@
+["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":2},"<main>","class\\class.rb","top",[],0,[],[1,["putnil"],["putnil"],["defineclass","Pi",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":3},"<class:Pi>","class\\class.rb","class",[],0,[],[2,["putnil"],["definemethod","initialize",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":2},"initialize","class\\class.rb","method",[],0,[],[3,["putobject",355.0],["dup"],["setinstancevariable","@a"],["leave"]]],0],6,["putnil"],["definemethod","calc",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":2,"stack_max":2},"calc","class\\class.rb","method",["b"],0,[],[7,["putobject",113.0],["setlocal",2],8,["getinstancevariable","@a"],["getlocal",2],["send","\/",1,null,0,null],["leave"]]],0],11,["putobject",1],["dup"],["putnil"],["setconstant","AAA"],["leave"]]],0],["pop"],13,["putnil"],["putnil"],["getconstant","Pi"],["getconstant","AAA"],["send","puts",1,null,8,null],["pop"],14,["putnil"],["putnil"],["getconstant","Pi"],["send","new",0,null,0,null],["send","calc",0,null,0,null],["send","puts",1,null,8,null],["leave"]]]
View
14 test/class/class.rb
@@ -0,0 +1,14 @@
+class Pi
+ def initialize
+ @a = 355.0
+ end
+
+ def calc
+ b = 113.0
+ return @a / b
+ end
+
+ AAA = 1
+end
+puts Pi::AAA
+puts Pi.new().calc
View
227 test/class/class2.json
@@ -0,0 +1,227 @@
+[
+ "YARVInstructionSequence/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size" : 0,
+ "local_size" : 1,
+ "stack_max" : 2
+ },
+ "<main>",
+ "class\\class.rb",
+ "top",
+ [],
+ 0,
+ [],
+ [
+ 1,
+ [
+ "putnil"
+ ],
+ [
+ "putnil"
+ ],
+ [
+ "defineclass",
+ "Pi",
+ [
+ "YARVInstructionSequence/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size" : 0,
+ "local_size" : 1,
+ "stack_max" : 3
+ },
+ "<class:Pi>",
+ "class\\class.rb",
+ "class",
+ [],
+ 0,
+ [],
+ [
+ 2,
+ [
+ "putnil"
+ ],
+ [
+ "definemethod",
+ "initialize",
+ [
+ "YARVInstructionSequence/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size" : 0,
+ "local_size" : 1,
+ "stack_max" : 2
+ },
+ "initialize",
+ "class\\class.rb",
+ "method",
+ [],
+ 0,
+ [],
+ [
+ 3,
+ [
+ "putobject",
+ 355
+ ],
+ [
+ "dup"
+ ],
+ [
+ "setinstancevariable",
+ "@a"
+ ],
+ [
+ "leave"
+ ]
+ ]
+ ],
+ 0
+ ],
+ 6,
+ [
+ "putnil"
+ ],
+ [
+ "definemethod",
+ "calc",
+ [
+ "YARVInstructionSequence/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size" : 0,
+ "local_size" : 2,
+ "stack_max" : 2
+ },
+ "calc",
+ "class\\class.rb",
+ "method",
+ [
+ "b"
+ ],
+ 0,
+ [],
+ [
+ 7,
+ [
+ "putobject",
+ 113
+ ],
+ [
+ "setlocal",
+ 2
+ ],
+ 8,
+ [
+ "getinstancevariable",
+ "@a"
+ ],
+ [
+ "getlocal",
+ 2
+ ],
+ [
+ "send",
+ "/",
+ 1,
+ 0
+ ],
+ [
+ "leave"
+ ]
+ ]
+ ],
+ 0
+ ],
+ 11,
+ [
+ "putobject",
+ 1
+ ],
+ [
+ "dup"
+ ],
+ [
+ "putnil"
+ ],
+ [
+ "setconstant",
+ "AAA"
+ ],
+ [
+ "leave"
+ ]
+ ]
+ ],
+ 0
+ ],
+ [
+ "pop"
+ ],
+ 13,
+ [
+ "putnil"
+ ],
+ [
+ "putnil"
+ ],
+ [
+ "getconstant",
+ "Pi"
+ ],
+ [
+ "getconstant",
+ "AAA"
+ ],
+ [
+ "send",
+ "puts",
+ 1,
+ 8
+ ],
+ [
+ "pop"
+ ],
+ 14,
+ [
+ "putnil"
+ ],
+ [
+ "putnil"
+ ],
+ [
+ "getconstant",
+ "Pi"
+ ],
+ [
+ "send",
+ "new",
+ 0,
+ 0
+ ],
+ [
+ "send",
+ "calc",
+ 0,
+ 0
+ ],
+ [
+ "send",
+ "puts",
+ 1,
+ 8
+ ],
+ [
+ "leave"
+ ]
+ ]
+]
View
2 test/compile.bat
@@ -0,0 +1,2 @@
+@echo off
+ruby compile.rb %1\%1.rb -o %1\%1.json -p %1\%1_pretty.json
View
51 test/compile.rb
@@ -0,0 +1,51 @@
+require 'optparse'
+require 'pp'
+require 'json'
+
+OutputCompileOption = {
+ :peephole_optimization =>true,
+ :inline_const_cache =>false,
+ :specialized_instruction =>false,
+ :operands_unification =>false,
+ :instructions_unification =>false,
+ :stack_caching =>false,
+}
+
+def compile_to_json infile, outfile, prettyfile
+ iseq = VM::InstructionSequence.compile_file(infile, OutputCompileOption)
+
+ open(outfile, 'w'){|f|
+ f.puts iseq.to_a.to_json
+ }
+ if prettyfile
+ open(prettyfile, 'w'){|f|
+ f.puts JSON::pretty_generate(iseq.to_a, :indent => "\t")
+ }
+ end
+end
+
+## main
+
+outfile = ''
+prettyfile = nil
+opt = OptionParser.new{|opt|
+ opt.on('-o file'){|o|
+ outfile = o
+ }
+ opt.on('-p file'){|o|
+ prettyfile = o
+ }
+ opt.version = '0.0.1'
+}
+
+opt.parse!(ARGV)
+
+ARGV.each{|file|
+ case outfile
+ when /\.json\Z/
+ compile_to_json file, outfile, prettyfile
+ else
+ raise
+ end
+}
+
View
1 test/const/const.json
@@ -0,0 +1 @@
+["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":2},"<main>","const\\const.rb","top",[],0,[],[1,["putnil"],["putnil"],["defineclass","Foo",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":3},"<class:Foo>","const\\const.rb","class",[],0,[],[2,["putstring","Foo"],["dup"],["putnil"],["setconstant","CONST"],["leave"]]],0],["pop"],5,["putnil"],["putnil"],["defineclass","Bar",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":2},"<class:Bar>","const\\const.rb","class",[],0,[],[6,["putstring","Bar"],["putnil"],["setconstant","CONST"],7,["putnil"],["putnil"],["getconstant","Foo"],["defineclass","Baz",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":2},"<class:Baz>","const\\const.rb","class",[],0,[],[8,["putnil"],["putnil"],["getconstant","CONST"],["send","puts",1,null,8,null],["pop"],10,["putnil"],["putnil"],["getconstant","Foo"],["getconstant","CONST"],["send","puts",1,null,8,null],["leave"]]],0],["leave"]]],0],["pop"],14,["putnil"],["putnil"],["defineclass","Foo2",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":3},"<class:Foo2>","const\\const.rb","class",[],0,[],[15,["putstring","Foo"],["dup"],["putnil"],["setconstant","CONST"],["leave"]]],0],["pop"],18,["putstring","Object"],["putnil"],["setconstant","CONST"],19,["putnil"],["putnil"],["getconstant","Object"],["getconstant","CONST"],["send","puts",1,null,8,null],["pop"],21,["putnil"],["putnil"],["getconstant","Foo2"],["defineclass","Bar2",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":2},"<class:Bar2>","const\\const.rb","class",[],0,[],[22,["putnil"],["putnil"],["getconstant","CONST"],["send","puts",1,null,8,null],["leave"]]],0],["pop"],27,["putnil"],["putnil"],["defineclass","Object",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":2},"<class:Object>","const\\const.rb","class",[],0,[],[28,["putnil"],["putnil"],["getconstant","Foo2"],["defineclass","Bar2",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":2},"<class:Bar2>","const\\const.rb","class",[],0,[],[29,["putnil"],["putnil"],["getconstant","CONST"],["send","puts",1,null,8,null],["leave"]]],0],["leave"]]],0],["pop"],33,["putnil"],["putnil"],["defineclass","Foo3",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":3},"<class:Foo3>","const\\const.rb","class",[],0,[],[34,["putstring","Foo"],["dup"],["putnil"],["setconstant","CONST"],["leave"]]],0],["pop"],36,["putnil"],["putnil"],["getconstant","Foo3"],["defineclass","Bar3",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":2},"<class:Bar3>","const\\const.rb","class",[],0,[],[37,["putnil"],["putnil"],["getconstant","CONST"],["send","puts",1,null,8,null],["pop"],38,["putstring","Bar"],["putnil"],["setconstant","CONST"],39,["putnil"],["putnil"],["getconstant","CONST"],["send","puts",1,null,8,null],["pop"],40,["putnil"],["putnil"],["getconstant","Foo3"],["getconstant","CONST"],["send","puts",1,null,8,null],["leave"]]],0],["leave"]]]
View
39 test/const/const.rb
@@ -0,0 +1,39 @@
+class Foo
+ CONST = 'Foo'
+end
+
+class Bar
+ CONST = 'Bar'
+ class Baz < Foo
+ puts CONST # => "Bar" Outer class const
+ # In this case, you have to specify if you want to see parent class const.
+ puts Foo::CONST # => "Foo"
+ end
+end
+
+class Foo2
+ CONST = 'Foo'
+end
+
+CONST = 'Object'
+
+class Bar2 < Foo2
+ puts CONST # => "Foo"
+end
+
+# If you specify "Object", then const in Object is searched before.
+class Object
+ class Bar2 < Foo2
+ puts CONST # => "Object"
+ end
+end
+
+class Foo3
+ CONST = 'Foo'
+end
+class Bar3 < Foo3
+ puts CONST # => "Foo"
+ CONST = 'Bar' # Define Bar's const "CONST"
+ puts CONST # => "Bar" (Foo::CONST is hidden)
+ puts Foo3::CONST # => "Foo" (You can see by "::")
+end
View
12 test/const/test2.rb
@@ -0,0 +1,12 @@
+class Foo
+end
+
+class Object
+
+end
+
+puts Foo
+puts Foo.new
+puts Object
+puts Object::Object
+puts Object::Object.new
View
142 test/def/defetst2.json
@@ -0,0 +1,142 @@
+[
+ "YARVInstructionSequence/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size" : 0,
+ "local_size" : 1,
+ "stack_max" : 2
+ },
+ "<main>",
+ "deftest.rb",
+ "top",
+ [],
+ 0,
+ [],
+ [
+ 1,
+ [
+ "putobject",
+ 1
+ ],
+ [
+ "putnil"
+ ],
+ [
+ "setconstant",
+ "ONE"
+ ],
+ 2,
+ [
+ "putobject",
+ 355
+ ],
+ [
+ "setglobal",
+ "$a"
+ ],
+ 3,
+ [
+ "putnil"
+ ],
+ [
+ "definemethod",
+ "pi",
+ [
+ "YARVInstructionSequence/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size" : 0,
+ "local_size" : 2,
+ "stack_max" : 2
+ },
+ "pi",
+ "deftest.rb",
+ "method",
+ [
+ "b"
+ ],
+ 0,
+ [],
+ [
+ 4,
+ [
+ "putobject",
+ 113
+ ],
+ [
+ "setlocal",
+ 2
+ ],
+ 5,
+ [
+ "getglobal",
+ "$a"
+ ],
+ [
+ "getlocal",
+ 2
+ ],
+ [
+ "send",
+ "/",
+ 1,
+ 0
+ ],
+ [
+ "putnil"
+ ],
+ [
+ "getconstant",
+ "ONE"
+ ],
+ [
+ "send",
+ "+",
+ 1,
+ 0
+ ],
+ [
+ "putobject",
+ 1
+ ],
+ [
+ "send",
+ "-",
+ 1,
+ 0
+ ],
+ [
+ "leave"
+ ]
+ ]
+ ],
+ 0
+ ],
+ 7,
+ [
+ "putnil"
+ ],
+ [
+ "putnil"
+ ],
+ [
+ "send",
+ "pi",
+ 0,
+ 24
+ ],
+ [
+ "send",
+ "puts",
+ 1,
+ 8
+ ],
+ [
+ "leave"
+ ]
+ ]
+]
View
1 test/def/deftest.json
@@ -0,0 +1 @@
+["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":2},"<main>","deftest.rb","top",[],0,[],[1,["putobject",1],["putnil"],["setconstant","ONE"],2,["putobject",355.0],["setglobal","$a"],3,["putnil"],["definemethod","pi",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":2,"stack_max":2},"pi","deftest.rb","method",["b"],0,[],[4,["putobject",113.0],["setlocal",2],5,["getglobal","$a"],["getlocal",2],["send","\/",1,null,0,null],["putnil"],["getconstant","ONE"],["send","+",1,null,0,null],["putobject",1],["send","-",1,null,0,null],["leave"]]],0],7,["putnil"],["putnil"],["send","pi",0,null,24,null],["send","puts",1,null,8,null],["leave"]]]
View
7 test/def/deftest.rb
@@ -0,0 +1,7 @@
+ONE = 1
+$a = 355.0
+def pi
+ b = 113.0
+ return $a / b + ONE - 1
+end
+puts pi
View
1 test/defDef/defDef.json
@@ -0,0 +1 @@
+["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":2},"<main>","defDefTest.rb","top",[],0,[],[1,["putobject",355.0],["setglobal","$a"],2,["putnil"],["definemethod","pi",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":1},"pi","defDefTest.rb","method",[],0,[],[3,["putnil"],["definemethod","pi2",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":2,"stack_max":2},"pi2","defDefTest.rb","method",["b"],0,[],[4,["putobject",113.0],["setlocal",2],5,["getglobal","$a"],["getlocal",2],["send","\/",1,null,0,null],["leave"]]],0],7,["putnil"],["send","pi2",0,null,24,null],["leave"]]],0],9,["putnil"],["putnil"],["send","pi",0,null,24,null],["send","puts",1,null,8,null],["leave"]]]
View
9 test/defDef/defDef.rb
@@ -0,0 +1,9 @@
+$a = 355.0
+def pi
+ def pi2
+ b = 113.0
+ return $a / b
+ end
+ pi2
+end
+puts pi
View
148 test/defDef/defDef2.json
@@ -0,0 +1,148 @@
+[
+ "YARVInstructionSequence/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size" : 0,
+ "local_size" : 1,
+ "stack_max" : 2
+ },
+ "<main>",
+ "defDefTest.rb",
+ "top",
+ [],
+ 0,
+ [],
+ [
+ 1,
+ [
+ "putobject",
+ 355
+ ],
+ [
+ "setglobal",
+ "$a"
+ ],
+ 2,
+ [
+ "putnil"
+ ],
+ [
+ "definemethod",
+ "pi",
+ [
+ "YARVInstructionSequence/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size" : 0,
+ "local_size" : 1,
+ "stack_max" : 1
+ },
+ "pi",
+ "defDefTest.rb",
+ "method",
+ [],
+ 0,
+ [],
+ [
+ 3,
+ [
+ "putnil"
+ ],
+ [
+ "definemethod",
+ "pi2",
+ [
+ "YARVInstructionSequence/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size" : 0,
+ "local_size" : 2,
+ "stack_max" : 2
+ },
+ "pi2",
+ "defDefTest.rb",
+ "method",
+ [
+ "b"
+ ],
+ 0,
+ [],
+ [
+ 4,
+ [
+ "putobject",
+ 113
+ ],
+ [
+ "setlocal",
+ 2
+ ],
+ 5,
+ [
+ "getglobal",
+ "$a"
+ ],
+ [
+ "getlocal",
+ 2
+ ],
+ [
+ "send",
+ "/",
+ 1,
+ 0
+ ],
+ [
+ "leave"
+ ]
+ ]
+ ],
+ 0
+ ],
+ 7,
+ [
+ "putnil"
+ ],
+ [
+ "send",
+ "pi2",
+ 0,
+ 24
+ ],
+ [
+ "leave"
+ ]
+ ]
+ ],
+ 0
+ ],
+ 9,
+ [
+ "putnil"
+ ],
+ [
+ "putnil"
+ ],
+ [
+ "send",
+ "pi",
+ 0,
+ 24
+ ],
+ [
+ "send",
+ "puts",
+ 1,
+ 8
+ ],
+ [
+ "leave"
+ ]
+ ]
+]
View
1 test/endBlock/endBlock.json
@@ -0,0 +1 @@
+["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":1,"stack_max":2},"<main>","endBlock\\endBlock.rb","top",[],0,[],[1,["putnil"],["putstring","Let's start !"],["send","puts",1,null,8,null],["pop"],2,["postexe",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":0,"stack_max":2},"block in <main>","endBlock\\endBlock.rb","block",[],0,[["redo",null,"label_0","label_9","label_0",0],["next",null,"label_0","label_9","label_9",0]],["label_0",2,["putnil"],["putobject",3],["send","puts",1,null,8,null],"label_9",["leave"]]]],3,["postexe",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":0,"stack_max":2},"block in <main>","endBlock\\endBlock.rb","block",[],0,[["redo",null,"label_0","label_9","label_0",0],["next",null,"label_0","label_9","label_9",0]],["label_0",3,["putnil"],["putobject",2],["send","puts",1,null,8,null],"label_9",["leave"]]]],4,["postexe",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":0,"stack_max":2},"block in <main>","endBlock\\endBlock.rb","block",[],0,[["redo",null,"label_0","label_9","label_0",0],["next",null,"label_0","label_9","label_9",0]],["label_0",4,["putnil"],["putobject",1],["send","puts",1,null,8,null],"label_9",["leave"]]]],["putnil"],["leave"]]]
View
4 test/endBlock/endBlock.rb
@@ -0,0 +1,4 @@
+puts "Let's start !"
+END { puts 3 }
+END { puts 2 }
+END { puts 1 }
View
237 test/endBlock/endBlock_pretty.json
@@ -0,0 +1,237 @@
+[
+ "YARVInstructionSequence\/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size": 0,
+ "local_size": 1,
+ "stack_max": 2
+ },
+ "<main>",
+ "endBlock\\endBlock.rb",
+ "top",
+ [
+
+ ],
+ 0,
+ [
+
+ ],
+ [
+ 1,
+ [
+ "putnil"
+ ],
+ [
+ "putstring",
+ "Let's start !"
+ ],
+ [
+ "send",
+ "puts",
+ 1,
+ null,
+ 8,
+ null
+ ],
+ [
+ "pop"
+ ],
+ 2,
+ [
+ "postexe",
+ [
+ "YARVInstructionSequence\/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size": 0,
+ "local_size": 0,
+ "stack_max": 2
+ },
+ "block in <main>",
+ "endBlock\\endBlock.rb",
+ "block",
+ [
+
+ ],
+ 0,
+ [
+ [
+ "redo",
+ null,
+ "label_0",
+ "label_9",
+ "label_0",
+ 0
+ ],
+ [
+ "next",
+ null,
+ "label_0",
+ "label_9",
+ "label_9",
+ 0
+ ]
+ ],
+ [
+ "label_0",
+ 2,
+ [
+ "putnil"
+ ],
+ [
+ "putobject",
+ 3
+ ],
+ [
+ "send",
+ "puts",
+ 1,
+ null,
+ 8,
+ null
+ ],
+ "label_9",
+ [
+ "leave"
+ ]
+ ]
+ ]
+ ],
+ 3,
+ [
+ "postexe",
+ [
+ "YARVInstructionSequence\/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size": 0,
+ "local_size": 0,
+ "stack_max": 2
+ },
+ "block in <main>",
+ "endBlock\\endBlock.rb",
+ "block",
+ [
+
+ ],
+ 0,
+ [
+ [
+ "redo",
+ null,
+ "label_0",
+ "label_9",
+ "label_0",
+ 0
+ ],
+ [
+ "next",
+ null,
+ "label_0",
+ "label_9",
+ "label_9",
+ 0
+ ]
+ ],
+ [
+ "label_0",
+ 3,
+ [
+ "putnil"
+ ],
+ [
+ "putobject",
+ 2
+ ],
+ [
+ "send",
+ "puts",
+ 1,
+ null,
+ 8,
+ null
+ ],
+ "label_9",
+ [
+ "leave"
+ ]
+ ]
+ ]
+ ],
+ 4,
+ [
+ "postexe",
+ [
+ "YARVInstructionSequence\/SimpleDataFormat",
+ 1,
+ 1,
+ 1,
+ {
+ "arg_size": 0,
+ "local_size": 0,
+ "stack_max": 2
+ },
+ "block in <main>",
+ "endBlock\\endBlock.rb",
+ "block",
+ [
+
+ ],
+ 0,
+ [
+ [
+ "redo",
+ null,
+ "label_0",
+ "label_9",
+ "label_0",
+ 0
+ ],
+ [
+ "next",
+ null,
+ "label_0",
+ "label_9",
+ "label_9",
+ 0
+ ]
+ ],
+ [
+ "label_0",
+ 4,
+ [
+ "putnil"
+ ],
+ [
+ "putobject",
+ 1
+ ],
+ [
+ "send",
+ "puts",
+ 1,
+ null,
+ 8,
+ null
+ ],
+ "label_9",
+ [
+ "leave"
+ ]
+ ]
+ ]
+ ],
+ [
+ "putnil"
+ ],
+ [
+ "leave"
+ ]
+ ]
+]
View
1 test/hash/hash.json
@@ -0,0 +1 @@
+["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":0,"local_size":2,"stack_max":4},"<main>","hash\\hash.rb","top",["v"],0,[],[1,["putnil"],["definemethod","printHash",["YARVInstructionSequence\/SimpleDataFormat",1,1,1,{"arg_size":1,"local_size":2,"stack_max":4},"printHash","hash\\hash.rb","method",["hash"],1,[],[2,["putnil"],["getlocal",2],["putstring","a"],["send","[]",1,null,0,null],["getlocal",2],["putstring","b"],["send","[]",1,null,0,null],["send","+",1,null,0,null],["getlocal",2],["putstring","c"],["send","[]",1,null,0,null],["send","+",1,null,0,null],["send","puts",1,null,8,null],["leave"]]],0],4,["putstring","a"],["putstring","Create "],["putstring","b"],["putstring","from "],["newhash",4],["setlocal",2],5,["getlocal",2],["putstring","c"],["putstring","Hash"],["send","[]=",2,null,0,null],[<