|Version 23 (modified by wbroekema, 8 years ago)|
CLPython - an implementation of Python in Common Lisp
CLPython is an implementation of the Python programming language in Common Lisp. A large part of the Python language features is already implemented by CLPython. Integration of CLPython with Lisp and existing Lisp libraries is still in progress.
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. CLPython is in the same league, offering integration between Python and Lisp of both language and libraries.
A large part of the Python language features is implemented by CLPython: basic data types, functions, classes, metaclasses, generators, closures. Some recently introduced features are still missing. On Current Status for an overview.
At the moment the most important functionality offered is the standard read-eval-print loop ("interpreter"). It lets you execute statements, including import of .py files. Work on really bridging the Python and Lisp worlds in a powerful way is ongoing. The CLIM-based
CLPython currently requires Allegro Common Lisp 8.0 (the Express version is sufficient). It can run in both "Modern" and "ANSI" images, but Python syntax is always case-sensitive. The main dependencies on Allegro CL are the yacc and its support for environments. Supporting other Lisp environments is a goal, but unless more people get involved it will not happen soon.
The source code is in a public CVS repository. To check out the code, issue these commands:
export CVSROOT=:pserver:email@example.com:/cvs-public login CVS password: cvspublic cvs co python
To load CLPython using ASDF, first create a symlink in the ASDF registry to "clpython.asd". Then evaluate:
(asdf:operate 'asdf:load-op 'clpython)
This should result in compilation and loading of all CLPython files. Then, to start the REPL:
:pa python (repl)
Start up the CLPython read-eval-print loop and play around:
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.