next(world);
}
+Stack.prototype.clone = function() {
+ var stack = new Stack();
+ stack.stack = this.stack.slice(0);
+ return stack;
+}
+
function Factor() {
this.words = { };
this.data_stack = new Stack();
YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
});
+factor.words["callcc0"] = new Word("callcc0", "primitive", function(world, next) {
+ var stack = world.data_stack;
+ var quot = stack.stack.pop();
+ var new_stack = stack.clone();
+ var old_next = world.next;
+ var cont = {
+ world: world,
+ next: function(world) {
+ world.next = old_next;
+ next(world);
+ },
+ stack: stack
+ };
+ new_stack.stack.push(cont);
+ world.data_stack = new_stack;
+ quot.execute(world, next);
+});
+
+factor.words["continue"] = new Word("continue", "primitive", function(world, next) {
+ var stack = world.data_stack;
+ var cont = stack.stack.pop();
+ world.data_stack = cont.stack.clone();
+ (cont.next)(world);
+});
+
Factor.prototype.define_word = function(name, source, func, world, next) {
factor.words[name] = new Word(name, source, function(world, next) {
var old = world.next;