comparison lib/js/urweb.js @ 973:e30c2409c9d0

More interpreter debugging
author Adam Chlipala <adamc@hcoop.net>
date Tue, 22 Sep 2009 13:41:23 -0400
parents c22e524a6dd3
children b851675a2c3d
comparison
equal deleted inserted replaced
972:733f67bb64e7 973:e30c2409c9d0
881 env = cons(v, env); 881 env = cons(v, env);
882 e = fr.e2; 882 e = fr.e2;
883 stack = cons({c: "a3", env: env}, stack.next); 883 stack = cons({c: "a3", env: env}, stack.next);
884 break; 884 break;
885 default: 885 default:
886 throw "Unknown Ur continuation kind"; 886 throw ("Unknown Ur continuation kind " + fr.c);
887 } 887 }
888 888
889 break; 889 break;
890 case "v": 890 case "v":
891 e = {c: "c", v: lookup(env, e.n)}; 891 e = {c: "c", v: lookup(env, e.n)};
920 case "r": 920 case "r":
921 if (e.l == null) 921 if (e.l == null)
922 throw "Empty Ur record in interpretation"; 922 throw "Empty Ur record in interpretation";
923 var fs = {}; 923 var fs = {};
924 stack = cons({c: "r", n: e.l.data.n, fs: fs, l: e.l.next}, stack); 924 stack = cons({c: "r", n: e.l.data.n, fs: fs, l: e.l.next}, stack);
925 e = e.l.data; 925 e = e.l.data.v;
926 break; 926 break;
927 case ".": 927 case ".":
928 stack = cons({c: ".", f: e.f}, stack); 928 stack = cons({c: ".", f: e.f}, stack);
929 e = e.r; 929 e = e.r;
930 break; 930 break;
940 var env0 = env; 940 var env0 = env;
941 var e0 = e.e; 941 var e0 = e.e;
942 e = {c: "c", v: cs(function() { return exec0(env0, e0); })}; 942 e = {c: "c", v: cs(function() { return exec0(env0, e0); })};
943 break; 943 break;
944 default: 944 default:
945 throw "Unknown Ur expression kind"; 945 throw ("Unknown Ur expression kind " + e.c);
946 } 946 }
947 } 947 }
948 } 948 }
949 949
950 function exec(e) { 950 function exec(e) {