This is compiler for the Clojure programming language that targets C as a backend.
We use a Trello board to keep track of ideas, proposals, TODOs, bugs and who's doing what. If you plan to contribute, please do join the board.
Additional documentation for the project can be found at the wiki.
ClojureC includes a submodule. To fetch it, do
git submodule init
git submodule update
Before you can run anything make sure you have GLib 2 and the Boehm-Demers-Weiser garbage collector installed. If
pkg-config --cflags glib-2.0
pkg-config --cflags bdw-gc
don't report errors you should be good.
Make sure you're using Leiningen 2 - older versions of Leiningen won't work. Run the testsuite:
lein test
All tests should pass.
Note that ClojureC is still in its experimental phase, so please don't expect a polish experience, yet.
ClojureC provides a very simple command line compiler interface. Let's say you have the following in the file /tmp/echo.cljc
:
(ns cljc.user)
(defn main [& args]
(doseq [arg args]
(pr arg "\n")))
Then if you do the following in the clojurec
directory
lein run /tmp/echo.cljc run/cljc.c cljc.user/main
cd run
make
you should have a cljc
executable in the run
directory that acts a little like echo
.
The easiest way to play around with ClojureC interactively is in the namespace clojurec.core-test
. For example:
(core-run '(pr (+ 1 2)))
=> [3]
See the README.md file in "clojurec/run/android".
See the README.md file in "clojurec/run/ios".