fixing bug in the assembler; it didn't see the target from PushControlFrame

This commit is contained in:
Danny Yoo 2011-03-10 15:02:42 -05:00
parent 4a60a852e7
commit 55d84eec95
2 changed files with 9 additions and 1 deletions

View File

@ -171,7 +171,7 @@ EOF
[(PopEnvironment? stmt) [(PopEnvironment? stmt)
empty] empty]
[(PushControlFrame? stmt) [(PushControlFrame? stmt)
empty] (list (PushControlFrame-label stmt))]
[(PopControlFrame? stmt) [(PopControlFrame? stmt)
empty]) empty])
(loop (rest stmts))))])))) (loop (rest stmts))))]))))

View File

@ -99,6 +99,14 @@ var Primitives = (function() {
'null?': function(arity, returnLabel) { 'null?': function(arity, returnLabel) {
var firstArg = MACHINE.env[MACHINE.env.length-1]; var firstArg = MACHINE.env[MACHINE.env.length-1];
return firstArg === NULL; return firstArg === NULL;
},
'add1': function(arity, returnLabel) {
var firstArg = MACHINE.env[MACHINE.env.length-1];
return firstArg + 1;
},
'sub1': function(arity, returnLabel) {
var firstArg = MACHINE.env[MACHINE.env.length-1];
return firstArg - 1;
} }
}; };
})(); })();