Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

jcompiler Build Status Coverage Status lines of code

A compiler for the J programming language.

Compiling J

jCompiler includes two backends: one harnesses LLVM, the other directly emits ARM instructions. Both of these are very much nascent.

Using the LLVM Backend

You will need LLVM 7 and Rust installed.

$ cargo build --release

You can then compile and run programs as follows:

$ target/release/jcompiler --backend=llvm <jfile>.ijs
$ ./<jfile>

Using the ARM Backend

In addition to Rust, you will also need an ARM cross-compiler toolchain such as those available from Linaro. Unpack the toolchain to /opt, and check the path at the top of, modifying it to use your path if necessary.

You can then compile and run programs as follows:

$ target/release/jcompiler --backend=arm <jfile>.ijs
$ ./<jfile>


You can find many examples of J programs in the jlang_programs directory. As one example, compiling this J program:

'Some array operations...'
*: 1 2 3 4
matrix =: 2 3 $ 5 + 2 3 4 5 6 7
10 * matrix
1 + 10 20 30
1 2 3 + 10
residues =: 2 | 0 1 2 3 4 5 6 7

with jcompiler and running the compiled binary will yield the following on stdout:

Some array operations...
1 4 9 16
 70  80  90
100 110 120
11 21 31
11 12 13
0 1 0 1 0 1 0 1

By default, jcompiler compiles programs to executables that run on the current machine. You can explicitly specify architecture using LLVM target triples:

$ target/release/jcompiler <jfile>.ijs --target=x86_64-pc-linux-gnu


The latest API reference for the master branch is available here.


There are two categories of tests: one for the parser, the other for the compiler. Both sets can be run with:

$ cargo test


At present, only the compilation process itself is benchmarked. Future benchmarks for compiled binaries themselves are planned. You can run the compiler benchmarks by invoking:

$ cargo bench

If you have gnuplot installed, graphs will be generated as part of the report. Here's a look at how the compiler runs with optimizations turned off:


compared with all optimizations turned on:


as of March 30th, 2019.

Related / Of Interest

Use "ARM gcc 7.2.1 (none)" with options "-O0 -mfloat-abi=hard".