Programming language / compiler experiments.
This project uses the Boehm-Demers-Weiser conservative garbage collector. To build this project, you will need to clone and build that library.
The commands below should be run in the root directory of this project (the
location of the main Cargo.toml
file).
$ git clone git://github.com/ivmai/bdwgc.git
$ cd bdwgc
$ ./autogen.sh
$ ./configure --enable-static
$ make -j
Notice that --enable-static
is used to ensure that libgc.a
is produced by
the build.
You need to have the dino-runtime
and dino-std
libraries built before
building the compiler. To build each of them, use the commands:
cargo build --manifest-path dino-runtime/Cargo.toml
cargo build --manifest-path dino-std/Cargo.toml
Once those are built, you can use the following command to build and run the compiler:
cargo run -- path/to/program.dino
When working on the runtime, it can be useful to use the following command to make sure everything is always kept up-to-date:
cargo build --manifest-path dino-runtime/Cargo.toml && \
cargo build --manifest-path dino-std/Cargo.toml && \
cargo run -- path/to/program.dino
To run the tests, use:
cargo test
You can set TESTCOMPILE=overwrite
to overwrite the stdout
and stderr
files. This should only be used when the compiler's output is modified or if
a test's output is modified.
TESTCOMPILE=overwrite cargo test
Step 1: install kcov
Step 2: Run the command:
cargo test --no-run --lib && kcov --exclude-pattern=/.cargo,/usr/lib --verify target/cov target/debug/dino-<HASH>
You need to replace <HASH>
with the right hash for the test executable.
This can be tricky to determine. If you run cargo test --no-run --lib
and
then ls -la target/debug
you can usually figure out which one it is by
looking at the most recently modified executable with the largest size. Be
careful because cargo test --no-run
will regenerate all the binary targets
too, so it becomes hard to tell which executable is the test executable. That's
why we pass in --lib
to make sure those executables aren't built. Worst come
worse: just guess and check!
The generated report will be in target/cov/index.html
.