Skip to content

Repository files navigation

JCC

linux build macos build build windows Open Issues Latest Release Downloads License Top Language JDK compatibility: 21+

JCC, the Johan Compiler Collection, is a collection of toy compilers built with ANTLR4. It compiles four small programming languages — BASIC, COL, Tiny, and Assembunny — to native executables.

JCC has two backends: LLVM, which emits LLVM IR compiled by Clang, and flat assembler (FASM), which emits x86-64 assembly. The LLVM backend is the default. The FASM backend is deprecated and will be removed in a future release; select it with --backend FASM.

System Requirements

The requirements depend on which backend you use.

LLVM backend (default)

  • Windows, Linux, or macOS
  • Java 21+
  • Clang 20+

The LLVM backend works on Windows, Linux, and macOS, but it is not bundled with JCC: you need to install Clang (version 20 or later) yourself. See Using LLVM as Backend for installation instructions. BASIC and COL executables depend on the static standard libraries libjccbas.a and libjcccol.a respectively, which are distributed together with JCC.

FASM backend (deprecated)

  • Windows
  • Java 21+

Executables created with the FASM backend depend on the library msvcrt.dll, which is a part of Windows. BASIC executables also depend on the BASIC standard library, libjccbas.dll, that is distributed together with JCC.

You can download the Java runtime from Adoptium.

Installation

Download the latest zip file from the GitHub releases page, and unzip it somewhere on your hard drive. Add the bin directory of the JCC distribution to the Path environment variable for your account.

Please note that while JCC itself is licensed under GPLv3, the included version of flat assembler is licensed under a specific license. A copy of this license can be found in the fasm subdirectory of the project.

Usage

With JCC in your Path, you can run it like this:

jcc <source file>

To get help, type:

jcc --help

By default JCC uses the LLVM backend; see Using LLVM as Backend for details. The FASM backend is deprecated and will be removed in a future release; select it with --backend FASM.

Languages

JCC compiles four small languages. Each has its own guide:

Language Description Extension
BASIC A subset of Microsoft QuickBASIC 4.5, with a garbage collector for dynamic strings. .bas
COL A statically typed language with functional elements, inspired by BASIC, C, Go, and Rust. .col
Tiny A minimal educational language for reading input, computing, and writing output. .tiny
Assembunny A tiny assembly language from Advent of Code 2016. .asmb

Contributing

See CONTRIBUTING.md for the branch workflow, and AGENTS.md for build and test commands.

About

A collection of toy compilers built using ANTLR4 and flat assembler

Topics

Resources

Contributing

Stars

1 star

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages