Bootstrap
Ideally, you'd clone the repo at ~/fu/:
cd ~
git clone [repo] fu
cd fu
To release-build a self-verifying compiler:
./release-safe
This will recursively build several generations of the compiler, until you have latest-built-by-latest.
This won't "install" the compiler for you automatically - you could either:
- put
~/fu/binin your;PATH - or simply
~/fu/bin/fuinstead ofto invoke the compiler:fu
~/fu/bin/fu
fu-0 The Fu Programming Language
To get started:
echo 'fn main() { println("Hello world!"); 0 }' >> hello.fu
Build it:
fu -b hello.fu
Run it:
./hello
Hello world!
fu --help for more options.
Compiler Development Setup
An automatic watch-rebuild-and-retest script is available at the root of the repo:
cd ~/fu
fu -r watch.fu
This builds and tests several generations of the compiler, immediately and on every compiler source change, starting from a base bootstrap of a known-to-work historical compiler version.
Running this for the first time will build and run the entire test suite. All artifacts are cached and subsequent runs are much faster.
Tracking Compiler Codegen
Every run of the test suite emits all code generated + various diagnostics to testdiff/now.td. The file is big and rarely commited, but very useful when you want to compare differences in codegen between two commits.
With watch.fu running, checkout the commit prior to your change, commit the now.td you get out of the testsuite, cherry-pick your change on top and enjoy the diff of everything it affects.
Tracking Compiler Performance
A script for benchmarking compiler performance is available at the root of the repo. To compare commits, kill watch.fu, reset --hard and run ./bench AAAAAAA BBBBBBB CCCCCCC. The script pre-builds per-commit non-self-testing release compiler executables, then runs them back to back compiling the compiler itself at the commit you started from. You'll also get rough comparisons of per-pass memory use.
Compiler Bug Auto-Reducer
TODO cleanup & describe reduce.js