This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let read_whole_file filename = | |
let fi = open_in filename in | |
try | |
let length = in_channel_length fi in | |
let result = String.create length in | |
really_input fi result 0 length; | |
close_in fi; | |
result | |
with e -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
langmap = dict( | |
python2=(__import__("python"), lambda code: popen_runner("python", code)), | |
python3=(__import__("python"), lambda code: popen_runner("python3.0", code)), | |
scheme_r5rs=(__import__("scheme_r5rs"), lambda code: popen_runner("gosh", code)), | |
) | |
for name in langmap: | |
print name | |
mod, runner = langmap[name] | |
globals().update(mod.__dict__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let print x = | |
let tag = Obj.tag x in | |
if (tag == Obj.string_tag) then | |
Printf.printf "%s\n" (Obj.obj x) | |
else if(tag == Obj.int_tag) then | |
Printf.printf "%d\n" (Obj.obj x) | |
else if(tag == Obj.double_tag) then | |
Printf.printf "%f\n" (Obj.obj x) | |
else | |
Printf.printf "Unknown Type!\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- object.c (revision 28993) | |
+++ object.c (working copy) | |
@@ -1542,7 +1542,21 @@ | |
rb_class_new_instance(int argc, VALUE *argv, VALUE klass) | |
{ | |
VALUE obj; | |
+ char* s; | |
+ if((s = getenv("RUBY_VERBOSE")) && strcmp(s, "")){ | |
+ printf("rb_class_new_instance: %s(", rb_class2name(klass)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: ../Python/pythonrun.c | |
=================================================================== | |
--- ../Python/pythonrun.c (revision 82245) | |
+++ ../Python/pythonrun.c (working copy) | |
@@ -1334,6 +1334,7 @@ | |
return ret; | |
} | |
+bool toplevel = true; | |
static PyObject * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: ../Python/pythonrun.c | |
=================================================================== | |
--- ../Python/pythonrun.c (revision 82245) | |
+++ ../Python/pythonrun.c (working copy) | |
@@ -1334,6 +1334,7 @@ | |
return ret; | |
} | |
+bool toplevel = true; | |
static PyObject * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Nil: pass | |
NIL = Nil() | |
class Concat: # <> | |
def __init__(self, x, y): | |
self.x = x | |
self.y = y | |
class Nest: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r 47352a8373fe prettyprint/prettyprint.py | |
--- a/prettyprint/prettyprint.py Fri Aug 27 21:25:45 2010 +0900 | |
+++ b/prettyprint/prettyprint.py Fri Aug 27 22:16:07 2010 +0900 | |
@@ -192,15 +192,15 @@ | |
return Line_(i, be(width, i, tail)) | |
if isinstance(y, Union): | |
return better(width, already, | |
- be(width, already, [(i, y.x)] + tail), | |
- be(width, already, [(i, y.y)] + tail)) | |
+ lambda:be(width, already, [(i, y.x)] + tail), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5982299 function calls (4897561 primitive calls) in 5.266 CPU seconds | |
Ordered by: standard name | |
ncalls tottime percall cumtime percall filename:lineno(function) | |
1 0.000 0.000 5.266 5.266 <string>:1(<module>) | |
35 0.000 0.000 0.000 0.000 prettyprint.py:118(__init__) | |
17 0.000 0.000 0.000 0.000 prettyprint.py:130(__init__) | |
393214 0.152 0.000 0.152 0.000 prettyprint.py:141(__init__) | |
131071 0.046 0.000 0.046 0.000 prettyprint.py:146(__init__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
子ノードではないパラメータの表示の仕方を少し変えた。(Name 'x' (Load))じゃなくて(Name (id: 'x') (Load))にした。 | |
>|lisp| | |
>>> for i in range(10): | |
... x, y = y, x + y | |
... print x, | |
... | |
===== AST ===== | |
(Interactive | |
(For |