Getting Started

How to get started with the Occult programming language.

What is Occult?

A systems programming language with the control of C and a modern syntax.

Occult is currently in alpha; expect bugs.

Building the Language

x86_64 only. Prebuilt binaries for Windows and Linux are on the GitHub releases page — skip to Running a Program to use those.

Linux Build Instructions

Prerequisites

  • C++23 or higher
  • clang
  • cmake
  • make
  • git

clang is required; gcc miscompiles parts of the compiler. CMakeLists.txt enforces clang++ / clang.

Linux Build Command

bash
git clone --recurse-submodules https://github.com/occultlang/occult.git && cd occult
chmod +x build.sh
./build.sh

Windows Build Command

powershell
git clone --recurse-submodules https://github.com/occultlang/occult.git && cd occult
cd occult
.\build.bat

Windows Build Instructions (Manual)

Prerequisites

  • Visual Studio (newer the better)
  • git
  • cmake

Visual Studio C++ Settings

Click any image to enlarge.
Open Visual Studio Installer, and click modify. Open Visual Studio Installer, and click modify.
Make sure you have C++ enabled. Make sure you have C++ enabled.
Enable clang tools for Windows. Enable clang tools for Windows.

Building with Visual Studio

powershell
git clone https://github.com/occultlang/occult.git
cd occult
cmake -G "Visual Studio 18 2026"

"Visual Studio 18 2026" is the generator name for Visual Studio 2026 — swap for your installed version. cmake -G on its own prints the available generators.

Open occult.slnx in the cloned directory. In Solution Explorer, right-click occultc → Properties (or Alt + Enter).

Set Platform Toolset to LLVM(clang-cl) and the C++ language standard to C++23. Apply.

Under C/C++ → Command Line, clear the Additional Options field. Apply.

Build.

Running a Program

The binary is occultc on Linux, occultc.exe on Windows. Source files use .occ.

Compiler Options

Use occultc.exe on Windows.

occultc -h shows the help menu. Usage: occultc [options] source.occ

Option What it does
-t, --time Show compilation time per stage.
-d, --debug Enable debug mode (implies --time).
-o, --output Output a native binary. Static ELF/PE when the program calls no library, dynamic ELF or importing PE when it does — no linker or toolchain needed. A program with any export fn becomes a .so or .dll through the same driver.
-c, --compile-only Output an object file: ELF .o on Linux, COFF .obj on Windows (pick with --format), for cc or cl to link.
-W, --writable-text Mark .text writable (with -c), for a db block the program writes into.
-l, --load A library for extern fns outside any module ... link "...". Repeatable; -lz, -l z, and -l libz.so.1 all work.
--abi Calling convention (default: host).
--format Object file format for -c (default: this host's). Picks the ABI unless --abi says otherwise.
--no-drectve Leave the MSVC /DEFAULTLIB directives out of a COFF object (for toolchains like mingw-w64).
-h, --help Show this message.
JIT is the default when neither -o nor -c is given; there is no -j / --jit flag. Everything after -- on the command line becomes the running program's argv, not occultc's options.

Hello World

Save as hello_world.occ:

occult
import stdio from std;

fn main() {
    std::printf("Hello, World!\n");
}

Run with the JIT:

bash
occultc hello_world.occ

Or produce a standalone binary: occultc -o hello hello_world.occ (-o hello.exe on Windows).

×