README
RADIANCE BOOTSTRAPPING COMPILER

Bootstrap compiler for the Radiance programming language, written in C99.

This is the Stage 0 compiler used to bootstrap Radiance from scratch. It
compiles Radiance source code to RISC-V machine code. Once built, it can be
used to compile the self-hosted Radiance compiler, which then recompiles
itself until a fixed point is reached.

BUILDING

  Requirements:

    * clang (or another C99 compiler)
    * lld (the LLVM linker)

  To build the compiler:

    make

  This produces `bin/radiance.s0`, the Stage 0 compiler binary.
  You can specify a different C compiler with:

    make CC=gcc

USAGE

    bin/radiance.s0 [options] <input.rad>

  Options:

    -o <path>       Output file path (required)
    -mod <path>     Register an additional module

COMPILER PIPELINE

  The compiler is structured as a series of passes:

    Scanner     (scanner.c)    Tokenizes source text
    Parser      (parser.c)     Builds an AST from tokens
    Desugar     (desugar.c)    Syntactic transformations on the AST
    Resolver    (resolver.c)   Name resolution and type checking
    Gen         (gen.c)        Code generation targeting RISC-V 64-bit
    RISC-V      (riscv.c)      Instruction encoding

  Supporting modules:

    ast.c         AST node definitions and utilities
    module.c      Module loading and management
    symtab.c      Symbol table
    strings.c     Interned string table
    ralloc.c      Region-based memory allocator
    io.c          File I/O helpers
    options.c     Command line option parsing
    gen/emit.c    Binary emission
    gen/data.c    Read-only and read-write data sections

FORMATTING

  To format source files before committing, run `make fmt`.

LICENSE

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