README
 \ | /
-     -
 / | \

RADIANCE

Radiance is a small statically-typed systems language designed for the Radiant[0]
computer system (https://radiant.computer). It currently targets RISC-V (RV64).

The compiler is self-hosted: written in Radiance, it compiles to RISC-V and
runs inside a RISC-V emulator on x86-64 platforms.

Currently, the Radiance compiler supports most of the R' language. See
https://radiant.computer/system/radiance/prime/ for more information on R'.

[0]: https://radiant.computer

REQUIREMENTS

  * Linux on x86-64
  * Make
  * Radiant's RISC-V Emulator
    (https://code.radiant.computer/emulator/)

BUILDING

  The compiler is self-hosted, so building from source requires bootstrapping
  from a seed binary. A known-good compiler is checked into the repository.

  The Radiant emulator is required to run the compiler and build process
  on x86-64. The build process will look for it in $PATH, unless $RAD_EMULATOR
  is set to its location:

      export RAD_EMULATOR=~/bin/emulator

  Then, build the compiler:

      make

  This uses the emulator to run the seed binary (`seed/radiance.rv64`) which
  compiles the self-hosted compiler source to produce `bin/radiance.rv64.dev`.

  To update the seed to a new fixed point:

      make seed

  This iterates self-compilation stages until two consecutive stages produce
  identical output, proving the compiler faithfully reproduces itself. See
  `seed/README` for full details on the seed workflow, verification, and
  how to handle breaking changes.

USAGE

  A package is a directory that holds its manifest `<name>.manifest`, its root
  module `<name>.rad`, and its other modules. For example,
  `example/example.manifest`:

      Package {
          name: "example",
          version: "0.1.0",
          dependencies: [
              Dependency { name: "std", version: "0.1.0" },
          ],
          modules: ["util"],
      }

  `modules` names the modules below the root module: `util` is the file
  `example/util.rad`. Dependencies are found by name: in the directories
  given with `-lib`, then in the `lib` directory of the package and of each
  of its parents, such as this repository's `lib`, which holds the standard
  library. `-dep <name>=<directory>` selects the package for one name.
  `lib/std/lang/manifest.rad` describes every field.

  Compile the package and its dependencies:

      emulator -run bin/radiance.rv64.dev example -o example.rv64

  A single module compiles as a package of its own, which depends on the
  packages it imports:

      emulator -run bin/radiance.rv64.dev hello.rad -o hello.rv64

  Run a compiled binary:

      emulator -run example.rv64

TESTING

  Run all tests:

      make test

  Individual test suites:

      make std-test    # Standard library tests
      make bin-test    # IL snapshots, executables, and assembly tests

PROJECT STRUCTURE

  seed/            Seed compiler binary and update tooling
  compiler/        Self-hosted compiler entry point
  lib/std/         Standard library
  lib/std/lang/    Compiler modules
  lib/std/arch/    Architecture backends
  test/            Test harnesses
  scripts/         Utility scripts
  vim/             Vim syntax files

EDITOR SUPPORT

  Vim syntax files for Radiance (.rad) and RIL (.ril) are in the vim/ folder.
  Copy them to ~/.vim/syntax/ for syntax highlighting.

LICENSE

  Licensed under the MIT License,
  Copyright (c) 2025-2026 Radiant Computer (https://radiant.computer)