Home

Awesome

Closer.js

Build Status NPM version Dependency Status devDependency Status

Closer.js is a parser for the Clojure programming language written in JavaScript, compatible with the Mozilla Parser API. It also provides much of the Clojure core library as a separate module (thanks in large part to swannodette/mori). All of this is heavily tested, with > 90% code coverage (the untested 10% is mostly unused code from the Jison parser generator).

It was created to be used on CodeCombat, a site that teaches users how to code by playing a game (there's multiplayer too!). CodeCombat is open-source, backed by YCombinator, participating in Google Summer of Code 2014, and is generally awesome all around. Go check it out!

This project could be useful for a variety of things like browser-based Clojure code editing, linting, syntax highlighting, auto-completion, and running sandboxed Clojure code in a browser.

Key Features

defmacro is not supported at the moment, as I haven't quite figured it out yet. Ideas and pull requests on how to go about it are always welcome!

Installation & Usage

Get it via NPM: npm install closer.

Closer works on Node.js and all modern browsers (via browserify). It has been tested on Node 0.10.24, Chromium 34, and Firefox 28.

closer.parse(src, options={})

closer.core

All implemented clojure.core functions are in this object. A list of what's available can be found here.

Ensure it is in scope (with the same name as that passed in the parser's coreIdentifier option) if you want to execute JS code generated from your AST using escodegen, for instance.

closer.assertions

This is a small module emulating Clojure's arity and type checks. You will never need to use this directly; only ensure it is in scope (with the same name as that passed in the parser's assertionsIdentifier option), if you want to execute JS code generated from your AST using escodegen, for instance.

Demo

Check out the demo page. Extensive examples of usage can be found in the core and functional tests.

Contributing

New contributors can look at issue #10 to dive in easily and quickly!

Closer's primary dependencies are the Jison parser generator and Mori. All new features and functions should have corresponding tests. Issues and pull requests are welcome. So are ideas, pointers, and code on how to implement defmacro in JavaScript.

Setup / workflow instructions:

License

Licensed under the MIT License.

Contributors