Saturday, February 23, 2008

Compiling Python through Lisp?













Several articles have described the similarities between Python and Lisp, e.g.
From my perspective Lisp compilers seems mature and produce relatively high performance code (about 10 times faster than Python), and if Python is compiled to Lisp it can probably be done without any restrictions to how the Python code is written (which doesn't seem to be the case with Shedskin and RPython that compile to C/C++ code).

A possible approach could be to to use the Antlr Python 2.5 grammar and rewrite to a tree grammar (which looks very similar to Lisp), and with the forthcoming Antlr version you can rewrite the tree grammars to another tree grammar which happen to be Lisp?

It is probably not as simple as suggested, but let me know if you try :-)

No comments: