Grojure programming language - a Java-like syntax atop Clojure
Clojure HTML
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.

It's 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.


Work on Grojure ceased in January 2014 when the author switched to Go as the development language for rebuilding the Groovy Language from scratch, see

All the example files supplied (i.e. those ending in .grj in the test directory) run OK, and looking at these reveals what syntax is implemented.


This final release is 0.11.0. It depends on Clojure 1.6.0-beta2.

[grojure "0.11.0"]

It incorporates a copy of Kern 0.7.0.


Copyright © 2013 Gavin "Groovy" Grover The Kern portions are Copyright © 2013 Armando Blancas

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


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.