2007-09-22から1日間の記事一覧

selfjs.html

<script src="secd_cod.js"></script> <script src="compiler.js"></script> <script> Array.prototype.toString=function(){return"["+this.join(",")+"]"} function main() { document.getElementById("compiler.secd.new").value=""; document.getElementById("fout").value="initialize ...\n"; setTimeout(main2,100);…

compiler.js

function COMPILE (E) { return COMP(E,null,[4,[21,null]]) function ATOM(E){ return E==null || typeof(E) != "object" } function COMP (E,N,C) { if(ATOM(E)) return [1,[LOCATION(E,N),C]] switch(E[0]){ case "QUOTE": return [2,[E[1][0],C]] case "…

HendersonのSECDマシンコンパイラのJavaScript版

compiler.lispは、lispがわかっていればいいのかもしれませんが、 括弧がやはり、読みにくいのでjavascriptに移植して可読性UP+高速化しました。 ファイル名はcompiler.jsです。 selfjs.htmlを開くと、compiler.lispをcompiler.jsを使ってコンパイルして…