Skip to content
This repository

Clojure implemented on top of Python

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 pyclojure
Octocat-spinner-32 .gitignore
Octocat-spinner-32 AUTHORS
Octocat-spinner-32 CHANGES.txt
Octocat-spinner-32 CNAME
Octocat-spinner-32 LICENSE.txt
Octocat-spinner-32 MANIFEST.in
Octocat-spinner-32 README.md
Octocat-spinner-32 guidelines.txt
Octocat-spinner-32 setup.py
README.md

PyClojure

This project consists of the first steps of an implementation of the Clojure language in Python. At the moment it is merely interpreted and is incomplete (see file test_lisp.py for examples).

Note: the clojure-py project is much further along at this point; however, I'm keeping this code around as an example of using the Ply tools.

What works:

  • REPL with history and readline support
  • Parsing and storage of trees of lists, vectors, atoms, integers, floats
  • 'def' and simple evaluation
  • A few builtin functions and access to functions in Python's main namespace
  • setup.py packaging

Dependencies

  • PLY, for lexing and parsing. It turns out Python is actually quite serviceable for writing compilers, particularly for prototyping -- one of the reasons for this project was to see how far I could push this.
  • Nose, to run unit tests.
  • Python 2.6+

Why Clojure-in-Python?

The long JVM startup time makes use of Clojure for scripting common system tasks somewhat unworkable, or at least irritating. NewLISP would be an option, but Clojure is such a nice Lisp; this particular implementation is meant to eventually be syntax-compatible with Clojure (as currently implemented on the JVM). The goal is to provide a real Lisp with macros, and Clojure's syntactic goodness, as well as immutable data structures, which can coexist with Python and make use of its extensive, 'batteries included' libraries.

There has been some discussion as well about getting Clojure running under PyPy, something which I think would be quite interesting.

Feel free to join in! For next steps, see Issues list on GitHub. Please see the file guidelines.txt for contribution guidelines.

Author

Primary contact: John Jacobsen, NPX Designs, Inc. john@mail.npxdesigns.com (See AUTHORS file for complete list of contributors)

Something went wrong with that request. Please try again.