-
Notifications
You must be signed in to change notification settings - Fork 112
Javier Olaechea edited this page Jul 10, 2016
·
6 revisions
One has to call compile-toplevel with the quoted form one wishes to disassemble. To do so, first bind the *environment* variable to a null lexenv (make-lexenv) if unbound and setup a compilation environment, with with-complilation-environment. For example, to disassemble (car ())
(let ((*environment* (make-lexenv)))
(with-compilation-environment
(compile-toplevel '(car ()))))which would output
"var l1=internals.intern('NIL','COMMON-LISP');
(function(){var TMP=(function(){var SYMBOL=l1,VALUE=SYMBOL.value;
if (VALUE===undefined) throw 'Variable `'+SYMBOL.name+\"' is unbound.\";
return VALUE;
})();
if (TMP===(function(){var SYMBOL=l1,VALUE=SYMBOL.value;
if (VALUE===undefined) throw 'Variable `'+SYMBOL.name+\"' is unbound.\";
return VALUE;
})()) return (function(){var SYMBOL=l1,VALUE=SYMBOL.value;
if (VALUE===undefined) throw 'Variable `'+SYMBOL.name+\"' is unbound.\";
return VALUE;
})();
else if (typeof TMP=='object'&&'car' in TMP) return TMP.car;
else throw 'CAR called on non-list argument';
})();
"