Currently, Cat party is a C parser implemented in Clojure/ClojureScript.
The eventual goal is to implement a C compiler, implemented in JavaScript (via compilation with ClojureScript), targeting JavaScript. I.e., a C compiler that can operate entirely within a web browser.
I have a larger goal in mind, but it's too early to say much about it.
To run the ClojureScript version, run the command
./scripts/brepl.sh
Then, navigate your web browser to localhost:9000
. Then, run the following commands in the REPL:
(require '[catparty.cparser :as cp])
(require '[catparty.prettyprint :as pp])
(pp/pretty-print cp/t)
This prints the parse tree of the test code at the bottom of cparser.cljc
.
You can run the same code in a Clojure REPL by running lein repl
, and then
(require '[catparty.cparser :as cp])
(require '[catparty.prettyprint :as pp])
(pp/pretty-print cp/t)
Supported features in the C parser are approximately:
- declarations (mostly)
- expressions (mostly)
- statements (mostly)
- typedef names
- preprocessor (completely nonexistent)
- probably lots of other stuff
The code is distributed under the GPL version 3. See LICENSE.txt.
David Hovemeyer, <[email protected]>