|Version 11 (modified by wbroekema, 10 years ago) (diff)|
CLPython - an implementation of Python in Common Lisp
Python is both a programming language and the name of the reference implementation; the implementation is sometimes called "CPython" to differentiate the two. Some other implementations are Jython (Java) and IronPython (C# on .NET/Mono). Each of these implementations has platform-specific features. For example, Jython offers a nice integration between Python and Java classes, and other data types. In the same way, CLPython will offer integration of Python with Lisp.
Besides these "stand-alone" compilers, there are also "bridges" between Python and other languages. For example, Python-on-Lisp is a bridge between Lisp and CPython which allows execution of Python code in Lisp programs.
CLPython currently requires Allegro Common Lisp 8.0 (the trial version is ok), as it depends on the yacc and support for environments in Allegro CL. The intention is to support more Lisp environments in the future.
A large part of the Python language features is implemented by CLPython (basic data types, functions, classes, metaclasses, generators, closures, ...). Many recently introduced features are still missing (e.g. "y = yield x"). The intention is to add these features to CLPython.
At the moment the most important functionality offered is the read-eval-print loop (called "interpreter" in the Python world), similar to the one from CPython. You can execute statements there, including import of .py files. Work on really bridging the Python and Lisp worlds in a powerful way is ongoing. Python modules written in C can not be used with CLPython.
There is no public CVS directory at the moment; the intention is to offer that in the future. You can download a "snapshot" of CLPython as sources or as precompiled fasl file. Both require Allegro CL 8.0.
- clpython_DATE.tgz - the sources, released under the LLGPL
- clpython_DATE.fasl - Allegro 8.0 fasl file, to be loaded in a "Modern" image
The way to start up the CLPython read-eval-print loop depends on whether you have the sources or the precompiled fasl.
:ld load ;; compile and load the .cl files :pa :python (repl)
:ld clpython_DATE :pa :python (repl)
Below, a sample interaction with the read-eval-print loop is shown.
python(7): (repl) [CLPython -- type `:q' to quit, `:help' for help] >>> print "hello world!" hello world! >>> def fact(n): ... if n <= 1: ... return 1 ... else: ... return n * fact(n-1) ... #<python-function fact @ #x71d67c9a> >>> fact(6) 720 >>> :q Bye
Trac Starting Points
- TracGuide -- Built-in Documentation
- The Trac project -- Trac Open Source Project
- Trac FAQ -- Frequently Asked Questions
- TracSupport -- Trac Support
For a complete list of local wiki pages, see TitleIndex.