gen/
.clang-format
570 B
.gitignore
30 B
.gitsigners
112 B
LICENSE
1.1 KiB
Makefile
911 B
README
1.8 KiB
ast.c
5.0 KiB
ast.h
15.1 KiB
desugar.c
23.1 KiB
desugar.h
286 B
gen.c
108.5 KiB
gen.h
4.9 KiB
io.c
1.1 KiB
io.h
444 B
limits.h
1.3 KiB
module.c
10.0 KiB
module.h
2.2 KiB
options.c
1.4 KiB
options.h
472 B
parser.c
68.3 KiB
parser.h
942 B
radiance.c
3.7 KiB
ralloc.c
2.0 KiB
ralloc.h
1.1 KiB
resolver.c
109.7 KiB
resolver.h
5.6 KiB
riscv.c
12.0 KiB
riscv.h
12.0 KiB
scanner.c
10.2 KiB
scanner.h
3.2 KiB
strings.c
2.6 KiB
strings.h
407 B
symtab.c
5.7 KiB
symtab.h
4.6 KiB
types.h
1.0 KiB
util.h
1.5 KiB
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)