Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Grojure programming language - a Java-like syntax atop Clojure
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

Grojure is a syntactic shell that sits above Clojure and the Kern monadic parsing library, using the balanced brackets, path expressions, and infix operators syntax from the tradition of languages like C, Java, C#, and JavaScript. All identifiers assigned to are immutable.

The grammar documented here is all implemented, with more functionality coming in the next version. It's also of interest as an example grammar for those using Kern to build their own grammars, showcasing as much as possible an in-place one-to-one monad-to-macro mapping from parser combinator to generated code.

The non-ASCII Unicode operators and ideographs used in Grojure will always be single-grapheme. So whereas an ASCII operator could be 3 graphemes, e.g. <=>, the Unicode operator will be only 1, e.g. . And whereas an ASCII name could be a camel-case word, e.g. groupBy, the Unicode ideograph will be 1 character, e.g. , allowing future syntax using ideographs to not require spaces between them.


This release is 0.10.0. It depends on Clojure 1.5.1 and Kern 0.7.0.

[grojure "0.10.0"]


Copyright © 2013 Gavin "Groovy" Grover

Distributed under the Eclipse Public License, the same as Clojure.


There's many ways to use Kern to run Grojure code.

Running scripts

One way is to put your code in a script file ending in .grj, and call grojure.grammar/run-grj-file on it:

(ns user
  (:use grojure.grammar))

(run-grj-file "my/dir/my_file.grj" "arg1" "arg2")

This will:

  • first run the Clojure code in the .clj file with the same name, here "my/dir/my_file.clj"
  • then run the Grojure code in the first paragraph of the .grj file, i.e. everything before the first U+2029 or end of file if none

The arguments are available as a list called *args* in the .clj file.

From within the first paragraph of the .grj file, the contents of each subsequent paragraph can be run as Clojure code by calling the appropriate vector entry in either this.cljParagraphs or _z, e.g. calling _z(1)("th", 'r) with (print (str (get *args* 0) (get *args* 1) "ee")) in the third paragraph of the file would print three.

Using the console

Call run-console:

(ns user
  (:use grojure.grammar))


Enter your commands, followed by a blank line to run them:

let a=7
let b=8
prt a+b

To exit, enter exit then the blank line:


The console mode is raw for now, but will be improved.

Other pages...

[GRAMMAR.MD] The grammar spec current for this version.

[ROADMAP.MD] A roadmap of future versions.

[CHANGES.MD] The list of changes made in each version so far.

Something went wrong with that request. Please try again.