On Sun, Feb 24, 2008 at 10:44:29PM -0800, Bob La Quey wrote:

I am not sure what the !!!! is about. One can implement
most languages with others.

Now to take it full circle why not implement Common Lisp
in clpython?

I'm going to guess that the '!!!' is because Python is Chris's favorite
language, and he's working on an implementation of something much smaller
in the other direction.

As far as the two directions, there is a difference.  Python is pretty much
defined as an interpreted language.  There are people trying to make
compilers for it, but it's hard.  Guido made a lot of design tradeoffs in a
manner that works ok for interpretation but doesn't lend itself well to
compilation.

Common lisp, on the other hand, definitely has native code generation in
mind.  Common lisp would be useful for writing an interpreter.  In fact,
it's probably a decent choice of a language to use to compile python, since
the lisp compiler is fully available to the programmer.  Transform the
python code into lisp, and you have a compiler readily available to compile
it for you.

Trying to write a common lisp interpreter in python is mostly just an
educational exercise, not likely to be useful for anything other than a
_very_ slow lisp interpreter.  A lisp compiler is going to be easier to
write in lisp than pretty much any other language (the code and common data
representation are intentionally the same).

For someone who wants to understand a bit more about how various common
lisps are implemented, I suggest loading snippets of code into one, and
giving it "(disassemble 'functionname)".  The standard only specifies that
it output the code that implements the given function, but most show the
assembly (or byte code, depending on the implementation).  Generally, even
the "primitives" of the language are implemented directly in lisp, and just
get compiled.

David

--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to