.githooks/
compiler/
kernel/
lib/
scripts/
seed/
sublime/
test/
vim/
.gitignore
333 B
.gitsigners
224 B
AGENTS.md
8.3 KiB
CONTRIBUTING
2.1 KiB
LICENSE
1.1 KiB
Makefile
2.5 KiB
README
3.4 KiB
STYLE
3.2 KiB
std.lib
2.1 KiB
std.lib.test
1.1 KiB
README
raw
| 1 | |
| 2 | \ | / |
| 3 | - - |
| 4 | / | \ |
| 5 | |
| 6 | RADIANCE |
| 7 | |
| 8 | Radiance is a small statically-typed systems language designed for the Radiant[0] |
| 9 | computer system (https://radiant.computer). It currently targets RISC-V (RV64). |
| 10 | |
| 11 | The compiler is self-hosted: written in Radiance, it compiles to RISC-V and |
| 12 | runs inside a RISC-V emulator on x86-64 platforms. |
| 13 | |
| 14 | Currently, the Radiance compiler supports most of the R' language. See |
| 15 | https://radiant.computer/system/radiance/prime/ for more information on R'. |
| 16 | |
| 17 | [0]: https://radiant.computer |
| 18 | |
| 19 | REQUIREMENTS |
| 20 | |
| 21 | * Linux on x86-64 |
| 22 | * Make |
| 23 | * Radiant's RISC-V Emulator |
| 24 | (https://code.radiant.computer/emulator/) |
| 25 | |
| 26 | BUILDING |
| 27 | |
| 28 | The compiler is self-hosted, so building from source requires bootstrapping |
| 29 | from a seed binary. A known-good compiler is checked into the repository. |
| 30 | |
| 31 | The Radiant emulator is required to run the compiler and build process |
| 32 | on x86-64. The build process will look for it in $PATH, unless $RAD_EMULATOR |
| 33 | is set to its location: |
| 34 | |
| 35 | export RAD_EMULATOR=~/bin/emulator |
| 36 | |
| 37 | Then, build the compiler: |
| 38 | |
| 39 | make |
| 40 | |
| 41 | This uses the emulator to run the seed binary (`seed/radiance.rv64`) which |
| 42 | compiles the self-hosted compiler source to produce `bin/radiance.rv64.dev`. |
| 43 | |
| 44 | To update the seed to a new fixed point: |
| 45 | |
| 46 | make seed |
| 47 | |
| 48 | This iterates self-compilation stages until two consecutive stages produce |
| 49 | identical output, proving the compiler faithfully reproduces itself. See |
| 50 | `seed/README` for full details on the seed workflow, verification, and |
| 51 | how to handle breaking changes. |
| 52 | |
| 53 | USAGE |
| 54 | |
| 55 | A package is a directory that holds its manifest `<name>.manifest`, its root |
| 56 | module `<name>.rad`, and its other modules. For example, |
| 57 | `example/example.manifest`: |
| 58 | |
| 59 | Package { |
| 60 | name: "example", |
| 61 | version: "0.1.0", |
| 62 | dependencies: [ |
| 63 | Dependency { name: "std", version: "0.1.0" }, |
| 64 | ], |
| 65 | modules: ["util"], |
| 66 | } |
| 67 | |
| 68 | `modules` names the modules below the root module: `util` is the file |
| 69 | `example/util.rad`. Dependencies are found by name: in the directories |
| 70 | given with `-lib`, then in the `lib` directory of the package and of each |
| 71 | of its parents, such as this repository's `lib`, which holds the standard |
| 72 | library. `-dep <name>=<directory>` selects the package for one name. |
| 73 | `lib/std/lang/manifest.rad` describes every field. |
| 74 | |
| 75 | Compile the package and its dependencies: |
| 76 | |
| 77 | emulator -run bin/radiance.rv64.dev example -o example.rv64 |
| 78 | |
| 79 | A single module compiles as a package of its own, which depends on the |
| 80 | packages it imports: |
| 81 | |
| 82 | emulator -run bin/radiance.rv64.dev hello.rad -o hello.rv64 |
| 83 | |
| 84 | Run a compiled binary: |
| 85 | |
| 86 | emulator -run example.rv64 |
| 87 | |
| 88 | TESTING |
| 89 | |
| 90 | Run all tests: |
| 91 | |
| 92 | make test |
| 93 | |
| 94 | Individual test suites: |
| 95 | |
| 96 | make std-test # Standard library tests |
| 97 | make bin-test # IL snapshots, executables, and assembly tests |
| 98 | |
| 99 | PROJECT STRUCTURE |
| 100 | |
| 101 | seed/ Seed compiler binary and update tooling |
| 102 | compiler/ Self-hosted compiler entry point |
| 103 | lib/std/ Standard library |
| 104 | lib/std/lang/ Compiler modules |
| 105 | lib/std/arch/ Architecture backends |
| 106 | test/ Test harnesses |
| 107 | scripts/ Utility scripts |
| 108 | vim/ Vim syntax files |
| 109 | |
| 110 | EDITOR SUPPORT |
| 111 | |
| 112 | Vim syntax files for Radiance (.rad) and RIL (.ril) are in the vim/ folder. |
| 113 | Copy them to ~/.vim/syntax/ for syntax highlighting. |
| 114 | |
| 115 | LICENSE |
| 116 | |
| 117 | Licensed under the MIT License, |
| 118 | Copyright (c) 2025-2026 Radiant Computer (https://radiant.computer) |