4 ms·
Most Lisp compilers have intermediate representations too, although these IRs are still technically Lisp code (although they may not be executable). There's a r
by sedachv 16y ago
Most Lisp compilers have intermediate representations too, although these IRs are still technically Lisp code (although they may not be executable). There's a really good series of blog posts about the IR of the SBCL compiler by Roman Marynchak:
http://insidelisp.blogspot.com/search/label/python-book http://insidelisp.blogspot.com/search/label/python-book
- pjscott 16y agoIt sometimes fun to take some random Lisp code and fully expand the macros: (macroexpand '(loop for x in list minimize (sin x))) The output depends on your Lisp compiler, but it can get pretty wild. This is why we have the macroexpand-1 function, to just expand the first macro it finds and stop before all collapses into madness. A compiler writer could get a lot of mileage out of this sort of thing. For example, a LET special form could be implemented as a macro that expands to a call to an anonymous function. All the looping forms could be turned into lambdas and recursion. As long as the compiler can handle that sort of thing nicely, this could really simplify the compiler code.