From 011cac1c8b6c923d5abc0537cea6593798de50ea Mon Sep 17 00:00:00 2001 From: S42yt Date: Fri, 16 Oct 2026 08:23:36 +0000 Subject: [PATCH] Update the tooling pages for the toolchain without Rust Installing from source needs a C compiler, tar and xz; the toolchain is one native executable; cross-compiling builds the runtime with burn; --no-std no longer links a separate runtime; the JIT settings are listed; the start page, versions table and migration notes no longer mention Rust. --- content/getting-started.mdx | 4 +-- content/index.mdx | 8 +++--- content/language/calling-c.mdx | 2 +- content/migration.mdx | 6 ++--- content/standards.mdx | 5 ++-- content/tooling/cli.mdx | 4 ++- content/tooling/compiler.mdx | 38 ++++++++++++++++------------- content/tooling/cross-compiling.mdx | 22 ++++++++--------- content/tooling/installation.mdx | 21 +++++++--------- content/tooling/no-std.mdx | 22 +++++++---------- content/tooling/toolchain.mdx | 9 ++++--- 11 files changed, 71 insertions(+), 70 deletions(-) diff --git a/content/getting-started.mdx b/content/getting-started.mdx index 18de30c..60d8b11 100644 --- a/content/getting-started.mdx +++ b/content/getting-started.mdx @@ -13,8 +13,8 @@ curl -fsSL https://raw.githubusercontent.com/burnlang/burnup/master/install.sh | ``` This installs the whole toolchain into `~/.burn/bin`: `burni` (interpreter), `burnc` (compiler), `burnfmt` -(formatter), `burn-lsp` (language server), `ash` (package manager) and `burn`, which combines them all. Building from source needs Rust -1.85 or newer for bvm, and native executables need a C toolchain (`cc`). See [installation](./tooling/installation.mdx) +(formatter), `burn-lsp` (language server), `ash` (package manager) and `burn`, which combines them all. Building from source needs a C compiler, +tar and xz, and native executables need a C toolchain (`cc`). See [installation](./tooling/installation.mdx) for options and other platforms. ## Hello world diff --git a/content/index.mdx b/content/index.mdx index 5354059..6155a3a 100644 --- a/content/index.mdx +++ b/content/index.mdx @@ -9,8 +9,8 @@ order: 0 # Burn Burn is a general purpose programming language with a clean syntax, static types that you rarely have to write, -and smart casts that follow your `if` checks. The compiler and its tools are written in Burn and run on bvm, the Burn -virtual machine, which is written in Rust. +and smart casts that follow your `if` checks. Burn is written in Burn: the compiler, its tools, the runtime and bvm, +the Burn virtual machine with its JIT, are Burn programs compiled to native code. ```burn def interface Shape { @@ -47,7 +47,7 @@ All backends share the same type checker and runtime library (the JavaScript bui JavaScript that matches it), so a program behaves the same way everywhere. The virtual machine, [bvm](./bvm/overview.mdx), is not tied to Burn: it has its own assembly language, bytecode -format, verifier and Rust API, and other languages can compile to it. +format, verifier, JIT and API, and other languages can compile to it. ## Where to go next @@ -107,5 +107,5 @@ format, verifier and Rust API, and other languages can compile to it. - [Burn archives (.bar)](./bvm/archives.mdx) - [Mixins](./bvm/mixins.mdx) - [Native interop](./bvm/native-interop.mdx) - - [Optimizing while running](./bvm/optimizing.mdx) + - [The JIT](./bvm/optimizing.mdx) - [Migrating from the Go version](./migration.mdx) diff --git a/content/language/calling-c.mdx b/content/language/calling-c.mdx index 1b478c3..c67556c 100644 --- a/content/language/calling-c.mdx +++ b/content/language/calling-c.mdx @@ -127,4 +127,4 @@ loads the arguments into the registers the C calling convention uses (`rdi`, `rs call, it writes the opposite: code that saves the registers C expects to keep, pushes C's register arguments in Burn's order and calls the Burn function. -The rest of Burn uses the same mechanism to move its own runtime and bvm from Rust to Burn. +Burn uses the same mechanism for its own runtime and bvm, which are written in Burn and call the C library this way. diff --git a/content/migration.mdx b/content/migration.mdx index de8395e..bec1b08 100644 --- a/content/migration.mdx +++ b/content/migration.mdx @@ -1,6 +1,6 @@ --- title: Migrating from the Go version -description: What changed in the Rust rewrite and how to update existing code. +description: What changed since the Go version and how to update existing code. order: 66 --- @@ -10,7 +10,7 @@ order: 66 | --- | --- | | `type Person { ... }` | `def type Person { ... }` | | `class Human { fun create(...) ... }` | `def struct Human(...) { ... static fun create(...) ... }` | -| interpreter written in Go | compiler written in Rust and x86-64 assembly | +| interpreter written in Go | compiler, bvm and runtime written in Burn, native code for x86-64 and arm64 | | `burn -exe file.bn` embedded the source in a Go program | `burn build file.bn` produces real machine code | | every number was a float | `int` and `float` are separate types | | `toString(x)` needed for `"a" + x` | `"a" + x` converts automatically | @@ -42,7 +42,7 @@ print(Human.greet(john)) ## Classes to structs -Earlier versions of the Rust rewrite had `def class`. Classes were replaced by +Earlier versions of the rewrite had `def class`. Classes were replaced by [structs](./language/structs-and-interfaces.mdx), and `def class` is now a compile error ("classes are now structs"). To update a class: diff --git a/content/standards.mdx b/content/standards.mdx index e10d9be..859e1dd 100644 --- a/content/standards.mdx +++ b/content/standards.mdx @@ -63,7 +63,7 @@ Burn itself and the toolchain released with it (the compiler, the standard libra `YY.RELEASE.PATCH`. ```text -26.1.0-experimental-6 +26.1.0-experimental-7 │ │ │ └─────┬──────┘ │ │ │ pre-release │ │ └── patch: fixes to that release @@ -75,7 +75,7 @@ Burn itself and the toolchain released with it (the compiler, the standard libra again at release `1`: `27.1.0`. - **The second number counts the releases of that year**, and the third the fixes to one release: `26.1.2` is the second fix of the first release of 2026. -- **Pre-releases end in `-experimental-N`**, counting up from `1`, before the release is final: `26.1.0-experimental-6` +- **Pre-releases end in `-experimental-N`**, counting up from `1`, before the release is final: `26.1.0-experimental-7` comes before `26.1.0`. - `burnup` also accepts short forms such as `26.1` and `^26.1`; see [installation](./tooling/installation.mdx). - Packages that move with the year, such as bindings that follow Burn's releases, can use yearly versions too. @@ -94,6 +94,7 @@ Every release of Burn is tagged `v` and listed in the | `26.1.0-experimental-4` | `v26.1.0-experimental-4` | native executables and JavaScript are back, generated by the compiler written in Burn | | `26.1.0-experimental-5` | `v26.1.0-experimental-5` | low-level code: [`unsafe`](./language/unsafe.mdx), [inline assembly](./language/inline-assembly.mdx) for every target and raw memory with [`std/memory`](./stdlib/memory.mdx); native executables for arm64; Burn builds itself from the boot compiler in its repository, so building it only needs Rust | | `26.1.0-experimental-6` | `v26.1.0-experimental-6` | modules: [import aliases](./language/modules.mdx#import-aliases) (`import "std/memory" as Mem`) and [imports inside functions and blocks](./language/modules.mdx#imports-inside-functions-and-blocks) | +| `26.1.0-experimental-7` | `v26.1.0-experimental-7` | no Rust: bvm and the runtime are written in Burn, the toolchain is one native executable, and Burn builds from assembly seeds with only a C compiler; [calling C](./language/calling-c.mdx) with `@Extern` | | `26.1.0` | `v26.1.0` | the first stable release of 2026, after the experimental ones | | `26.2.0`, `26.3.0`, … | `v26.2.0`, … | the next releases of 2026; fixes to a release are `26.1.1`, `26.1.2`, … | | `27.1.0` | `v27.1.0` | the first release of 2027 | diff --git a/content/tooling/cli.mdx b/content/tooling/cli.mdx index a83720a..7851b6a 100644 --- a/content/tooling/cli.mdx +++ b/content/tooling/cli.mdx @@ -62,7 +62,9 @@ The older flags still work: `-r`, `-e`, `-exe ` and `-d`. | `BURN_PLATFORM` | build native executables for another platform: `linux-x86_64`, `macos-x86_64`, `linux-aarch64` or `macos-aarch64` ([cross-compiling](./cross-compiling.mdx)) | | `BURN_RUNTIME_DIR` | the folder with the runtime native executables link against (default `share/burn/lib`) | | `NO_COLOR` | disable colored diagnostics | -| `BURN_CLI_BVM` | the command line module bvm runs when it is started as `burn`, `burni`, `burnc` or `burn-lsp` (default `share/burn/burn.bvm` next to its `bin/`) | +| `BURN_JIT` | `0` turns bvm's [JIT](../bvm/optimizing.mdx) off, so everything is interpreted | +| `BURN_JIT_THRESHOLD` | how many calls or loop turns make a function hot enough for the JIT (default 1000) | +| `BURN_SYMBOLS` | `1` names every function in the assembly of native builds, for debuggers and profilers | | `BURN_HOME` | where packages are found (default `~/.burn`, packages in `packages/`) | | `BURN_GC_THRESHOLD` | bytes allocated between two searches for unreachable cycles (default 32 MB) | | `BURN_GC_STATS` | print a line after every cycle search | diff --git a/content/tooling/compiler.mdx b/content/tooling/compiler.mdx index 787027f..fd3a8de 100644 --- a/content/tooling/compiler.mdx +++ b/content/tooling/compiler.mdx @@ -28,10 +28,10 @@ knows the static type of its arguments. ## Runtime All values are 64 bit words. Ints, floats, bools and enums are stored directly, everything else is a pointer to a -heap object with a 16 byte header (kind, flags, type id, size). The runtime core is part of bvm and written in -Rust (`bvm/runtime`): memory and reference counting with a cycle collector, strings, arrays, maps, boxing for -`any`, formatting, HTTP, files and async tasks. The functions built on top of it, such as `split`, `trim` or -`parseJSON`, are written in Burn (`lib/runtime`), compiled to a bvm module that bvm links into every program. +heap object with a 16 byte header (kind, flags, type id, size). The runtime is written in Burn (`lib/rt`): memory +and reference counting with a cycle collector, strings, arrays, maps, boxing for `any`, formatting, JSON, HTTP, files +and async tasks. It calls the C library through `@Extern`, is compiled into the toolchain for bvm, and is linked into +native executables as `libburn_runtime.a`. ## Ownership @@ -49,8 +49,9 @@ computed once from the type graph. general-purpose stack VM with its own assembly language, bytecode format and verifier. Burn structs become `struct` types, interface methods become dispatch tables, `async` calls become `spawn`, and every operation that can fail carries its source location. When the module is loaded, the verifier computes each function's frame -size and common sequences are fused into superinstructions for loops, comparisons and field access. Checking and -compiling a typical program takes a few milliseconds, so running a file feels like using an interpreter. +size and common sequences are fused into superinstructions for loops, comparisons and field access; functions that +run often are compiled to machine code by [the JIT](../bvm/optimizing.mdx). Checking and compiling a typical program +takes a few milliseconds, so running a file feels like using an interpreter. `burnc --target bvm` writes the same module to a `.bvmc` file, and `--target bar` into an archive. ## Native code @@ -61,10 +62,10 @@ expressions evaluate into `rax` or `x0`, comparisons in conditions become compar access are inlined, and interface calls go through per-method dispatch tables. Both generators share the data layout, the order of arguments on the stack and the code that decides what a native program exports (`compiler/src/native/shared.bn`), so the same runtime serves both. The program entry point and the -trampoline that starts async tasks are hand-written assembly. The assembly is linked by `cc` with a static build of -the runtime (bvm and its runtime core, compiled by `scripts/native-runtime.sh` into `share/burn/lib`), so the result -is a standalone executable. A program that imports bytecode libraries embeds them, and bvm runs them inside the -executable. +trampoline that starts async tasks are generated assembly. The assembly is linked by `cc` with the runtime +(`libburn_runtime.a`, built by `scripts/native-runtime.sh` into `share/burn/lib`), so the result is a standalone +executable. A program that imports bytecode libraries is compiled to bytecode instead and linked with bvm +(`libburn_launcher.a`), which runs it inside the executable. `--target js` turns the IR into one JavaScript file instead (`compiler/src/js/js.bn`), with a runtime written in JavaScript in front of it (`lib/js/prelude.js`): every function becomes a JavaScript function, records become arrays @@ -72,15 +73,18 @@ tagged with their type, and checked operations call small helpers that report th ## Without the standard library -Programs built with `--no-std` or `std = false` link only the built-in core of the runtime (`libburn_core.a`, the -runtime core built without `std`), and the checker rejects the features it leaves out ([details](./no-std.mdx)). +Programs built with `--no-std` or `std = false` cannot import the standard library, and the checker rejects the +features it leaves out ([details](./no-std.mdx)). ## Bootstrapping -The compiler builds itself. bvm runs the boot compiler kept in the repository (`compiler/boot/compiler.bvmc`, a -compiled copy of the compiler), which compiles `compiler/src` once; that compiler builds itself again, and both -results must be the same module (`scripts/bootstrap.sh`). Building needs only Rust, for bvm; until -`26.1.0-experimental-4` a released Burn (stage0) started the bootstrap instead. Releases up to +The compiler builds itself. The C compiler assembles the seed kept in the repository (`compiler/boot/.tar.xz`, +the compiler as assembly), which compiles `compiler/src` once; that compiler builds itself again, and both results +must be the same assembly (`scripts/bootstrap.sh`). Building needs only a C compiler, tar and xz +([details](../internals/toolchain.mdx#how-the-compiler-builds-itself)). Until `26.1.0-experimental-4` a released Burn +(stage0) started the bootstrap, and until `26.1.0-experimental-7` a bytecode copy of the compiler run by the bvm +written in Rust. Releases up to `26.1.0-experimental-2` were compiled by a compiler written in Rust; it was retired once the compiler written in Burn did everything it did. `26.1.0-experimental-3` shipped without the native and JavaScript backends, and -`26.1.0-experimental-4` brings both back, ported to Burn. +`26.1.0-experimental-4` brings both back, ported to Burn. Since `26.1.0-experimental-7` bvm and the runtime are +written in Burn too, and no Rust is left. diff --git a/content/tooling/cross-compiling.mdx b/content/tooling/cross-compiling.mdx index 4c408f4..f6d8c50 100644 --- a/content/tooling/cross-compiling.mdx +++ b/content/tooling/cross-compiling.mdx @@ -22,7 +22,7 @@ On any other system (Windows, 32-bit ARM, RISC-V), use `burn run`, bytecode (`-- (`--target bar`) or JavaScript (`--target js`), which run everywhere bvm or Node.js runs. ```sh -burn version # Burn 26.1.0-experimental-6 +burn version # Burn 26.1.0-experimental-7 burnc app.bn # ./app for this computer file app # Mach-O 64-bit executable arm64, on an Apple silicon Mac burn dump --asm app.bn # the assembly it was built from @@ -33,9 +33,9 @@ burn dump --asm app.bn # the assembly it was built from - **A C toolchain.** `cc` assembles the generated `.s` file and links the executable. On macOS, install the Xcode command line tools (`xcode-select --install`); on Linux, `gcc` or `clang` (`apt install build-essential`). Set `BURN_CC` (or `CC`) to use another one. -- **The runtime.** Every toolchain ships it in `share/burn/lib`: `libburn_runtime.a` (bvm and the runtime core, so - executables can also run embedded bytecode libraries), `libburn_core.a` (the runtime without the standard library, - for [`--no-std`](./no-std.mdx)) and `native-libs.txt` (the system libraries the runtime needs). +- **The runtime.** Every toolchain ships it in `share/burn/lib`: `libburn_runtime.a` (the runtime written in Burn), + `libburn_launcher.a` (bvm written in Burn, for executables that run bytecode) and `native-libs.txt` (the system + libraries the runtime needs). Nothing else is needed at run time: the executable only uses the C library of the system it runs on. @@ -63,9 +63,8 @@ built for it, and `BURN_CC` at a linker for it. For example, from an x86-64 Linu ```sh sudo apt install gcc-aarch64-linux-gnu libc6-dev-arm64-cross -rustup target add aarch64-unknown-linux-gnu -TARGET=aarch64-unknown-linux-gnu sh scripts/native-runtime.sh ~/burn-runtime-arm64 +TARGET=aarch64-unknown-linux-gnu BURN_CC=aarch64-linux-gnu-gcc sh scripts/native-runtime.sh ~/burn-runtime-arm64 BURN_PLATFORM=linux-aarch64 \ BURN_RUNTIME_DIR=~/burn-runtime-arm64 \ @@ -73,9 +72,9 @@ BURN_CC=aarch64-linux-gnu-gcc \ burnc app.bn -o app-arm64 ``` -`scripts/native-runtime.sh` is in the Burn repository; it compiles bvm's runtime with `rustc` for the Rust target -you name (`aarch64-apple-darwin`, `x86_64-apple-darwin`, `aarch64-unknown-linux-gnu` or -`x86_64-unknown-linux-gnu`). `BURN_PLATFORM` alone is enough to look at the generated code: +`scripts/native-runtime.sh` is in the Burn repository; it compiles the runtime written in Burn (and bvm) with `burn` +for the target you name (`aarch64-apple-darwin`, `x86_64-apple-darwin`, `aarch64-unknown-linux-gnu` or +`x86_64-unknown-linux-gnu`) and assembles it with `BURN_CC`. `BURN_PLATFORM` alone is enough to look at the generated code: ```sh BURN_PLATFORM=macos-aarch64 burn dump --asm app.bn @@ -86,7 +85,8 @@ Mac. To try an arm64 Linux executable on an x86-64 computer, run it with `qemu-a ## How it is tested -The test suite (`cargo test`) builds every program in `tests/cases` natively and compares its output with bvm, also -with a small cycle-collection threshold, without the standard library, and with bytecode libraries and mixins. CI +The test suite (`sh scripts/test.sh`, written in Burn in `tests/run.bn`) builds every program in `tests/cases` +natively and compares its output with bvm, also with a small cycle-collection threshold, with the JIT compiling +everything, without the standard library, and with bytecode libraries and mixins. CI runs it on Linux x86-64 and on a Mac with Apple silicon. On Linux, the suite also cross-compiles every test program to arm64 and runs it under qemu. diff --git a/content/tooling/installation.mdx b/content/tooling/installation.mdx index ebe61d8..ec314b2 100644 --- a/content/tooling/installation.mdx +++ b/content/tooling/installation.mdx @@ -38,9 +38,9 @@ See [the toolchain](./toolchain.mdx) for what each command does. - Linux or macOS (Windows: see [manual installation](#manual-installation)) - `git`, which burnup and ash use to download Burn versions and packages -- Rust 1.85 or newer for versions built from source (branches such as `master`, and any version without a - prebuilt release), which builds bvm. Pass `--install-rust` to the installer to get it with rustup. Nothing else is - needed: bvm runs the boot compiler that comes with the sources. +- A C compiler (`cc`), `tar` and `xz` for versions built from source (branches such as `master`, and any version + without a prebuilt release): the C compiler assembles the seed that comes with the sources, which builds the rest. + Nothing else is needed, no Burn and no Rust. - A C toolchain (`cc`) to build native executables with `burnc`. Everything else works without it. ## Versions @@ -93,7 +93,6 @@ burnup self uninstall # everything: versions, packages, commands and the | `--prefix ` | install into `` instead of `~/.burn` | | `--toolchain ` | the Burn version to install first (default: the latest) | | `--from-source` | build Burn and burnup from source instead of downloading them | -| `--install-rust` | install Rust with rustup when a source build needs it | | `--no-ash` | do not install ash | | `--no-modify-path` | do not touch your shell profile | @@ -127,16 +126,14 @@ tar -xzf burn-linux-x86_64.tar.gz ## Manual installation -Any platform with Rust can build the toolchain from a checkout: +Linux and macOS, on x86-64 and arm64, can build the toolchain from a checkout with a C compiler, `tar` and `xz`: ```sh sh scripts/package.sh --prefix ~/.burn ``` -This builds bvm, lets bvm run the boot compiler in `compiler/boot` to compile the compiler written in Burn, lets that -compiler build itself and the command -line, and lays out `bin/` (`burn`, `burni`, `burnc` and `burn-lsp` are bvm, `burnfmt` is a script) and -`share/burn/`. To do it by hand, copy `target/release/bvm` to `bin/bvm` and `bin/burn` (and to `burni`, `burnc` -and `burn-lsp`, or link them), and put the command line module, built with -`bvm compiler/boot/compiler.bvmc build compiler/src/bin/burn.bn -o burn.bvm`, at `share/burn/burn.bvm` next to `bin/`. -`BURN_CLI_BVM` can point at it instead. +This assembles the seed in `compiler/boot` (the compiler written in Burn, as assembly for this platform), lets it +build the compiler from `compiler/src` until the compiler reproduces itself +([how the compiler builds itself](../internals/toolchain.mdx#how-the-compiler-builds-itself)), builds `bin/burn` and +the runtime libraries with it, and lays out `bin/` (`burni`, `burnc`, `burn-lsp` and `bvm` are links to `burn`, +`burnfmt` is a script) and `share/burn/`. It takes under a minute. diff --git a/content/tooling/no-std.mdx b/content/tooling/no-std.mdx index 8177e02..d7c6980 100644 --- a/content/tooling/no-std.mdx +++ b/content/tooling/no-std.mdx @@ -1,19 +1,14 @@ --- title: Building without the standard library -description: Small native executables that use only the built-in core of the language, without the standard library. +description: Programs that use only the built-in core of the language, without the standard library. order: 46 --- # Building without the standard library -Like `no_std` in Rust, a program can be built with only the core of the language: no standard library modules and none -of the runtime behind them (threads for `async fun`, the HTTP client, JSON, processes, time zones and bytecode -libraries). The checker rejects everything else, so such a program depends on nothing but the core runtime, and a -native executable gets much smaller: - -| Program | With the standard library | Without | -| --- | --- | --- | -| `print("hello")` | 345 KB | 35 KB | +A program can be built with only the core of the language: no standard library modules and none of the features +behind them (threads for `async fun`, the HTTP client, JSON, processes, time zones and bytecode libraries). The +checker rejects everything else, so such a program depends on nothing but the core of the language. ```sh burn build app.bn --no-std @@ -66,7 +61,8 @@ on bvm, which makes no difference to what it prints. ## How it works -The runtime crate is compiled twice. The full build uses Rust's standard library. The other one is `no_std`: it uses -only `core` and `alloc`, takes memory from `malloc` and talks to the system through a few C library calls (`write`, -`read`, `open`, `getenv`, `clock_gettime`, `nanosleep`). Both are embedded in the `burn` binary, and `burn build` -links the one the program needs. The generated machine code is the same either way. +The checker keeps the standard library out of the program and rejects the built-in features that need it, but a +native executable links the same runtime written in Burn either way, and the linker drops the runtime code the +program does not use (`--gc-sections`). Until `26.1.0-experimental-7` the runtime was written in Rust and `--no-std` +linked a smaller build of it without Rust's standard library; now every program gets the small runtime, so hello world +is about 220 KB with or without `--no-std`. diff --git a/content/tooling/toolchain.mdx b/content/tooling/toolchain.mdx index d646a05..687e133 100644 --- a/content/tooling/toolchain.mdx +++ b/content/tooling/toolchain.mdx @@ -6,14 +6,15 @@ order: 35 # The toolchain -`burn` is bvm, the Burn virtual machine. Started as `burn`, `burni`, `burnc` or `burn-lsp` (links to it), it runs -the command line written in Burn (`share/burn/burn.bvm`), which checks the name it was started with. `burnfmt` runs -the formatter written in Burn, and `bvm` is the virtual machine on its own. +`burn` is one native executable written in Burn, with the compiler and bvm, the Burn virtual machine, inside. +Started as `burn`, `burni`, `burnc` or `burn-lsp` (links to it), it is the command line in that role; started as +`bvm` (another link), it is the virtual machine on its own. `burnfmt` runs the formatter written in Burn. ## `burni`: the interpreter `burni` type-checks a program, compiles it to a [bvm](../bvm/overview.mdx) module in memory and runs it. There is -no build step: a program starts in a few milliseconds. `burni` also runs `.bvm` and `.bvmc` files. +no build step: a program starts in a few milliseconds, and code that runs often is compiled to machine code while it +runs ([the JIT](../bvm/optimizing.mdx)). `burni` also runs `.bvm` and `.bvmc` files. ```sh burni app.bn # run a program