Building the compiler
Beans is self-hosted: the compiler is written in Beans. To build it from source
you need an existing beansc to compile it with. The project Makefile drives
the build, and VERSION
is the single version source.
What you need
Section titled “What you need”- clang
- lld
- make
- git
On Debian or Ubuntu:
sudo apt-get install clang lld make gitOn macOS, native builds also need the command-line tools:
xcode-select --installBuilding on a public checkout
Section titled “Building on a public checkout”A checkout builds build/beansc using an already-installed beansc: the
one on your PATH, or at
$BEANS_HOME/bin/beansc. Under the hood it runs:
beansc build --release src/main.b -o build/beansc.newThe full loop:
# 1. install a release compiler first (the one-line installer)# 2. get the sourcegit clone https://github.com/beans-lang/beans.gitcd beans# 3. buildmake# 4. check it./build/beansc --version./build/beansc run examples/hello.bChoose which compiler bootstraps the build with BEANSC_BOOT:
make BEANSC_BOOT=/path/to/beanscSee Install Beans for the one-line installer.
The self-hosting proof
Section titled “The self-hosting proof”The old C++ stage-0 bootstrap is gone. A released Beans compiler now bootstraps
the source compiler. make test-fixpoint rebuilds the compiler twice with the
same release flags and requires the two binaries to be byte-identical. That
fixed point proves the self-hosted compiler reproduces itself.
make test runs the behavioural suites and the fixed-point gate. See Running
the tests.
Installing
Section titled “Installing”sudo make install PREFIX=/usr/localThis installs beansc, the runtime sources, and the standard library.
See Running the tests and Contributing for the change workflow.