Getting Started

How to build and use Bramble

Instructions for building and using Bramble and Thorn.

Building the Bramble Compiler

Requirements

Rust

Bramble is written in Rust and to build the compiler you will need Rust and Cargo installed. The easiest way to setup Rust is to get rustup and install the latest stable toolchain.

LLVM

Bramble uses LLVM as a compiler backend, so you will need to install the LLVM libraries on your machine. Bramble has been tested against LLVM 11 and 13.

From Source
  1. You can go to the LLVM site and follow the instructions to build and install the libraries yourself.
MacOS

Using Homebrew:

brew install llvm
Fedora

Using DNF:

dnf install llvm-devel
Debian & Ubuntu

Follow the instructions provided on this site.

gcc

The Bramble make script, make.sh, uses GCC as a linker between compiled binaries.

Building

After Rust has been installed.

  1. Clone the Bramble repository:
  2. Build and test Bramble by running cargo test. This will build Bramble and execute all the unit tests.
  3. Build a release version of Bramble: cargo build --release
  4. Execute integration tests: go into the ./tests directory and run ./tests.sh. This will execute all the integration tests for Bramble and will validate that both the compiler and LLVM are functioning properly.
  5. Use ./make.sh to compile and run your own projects.

Hello World

  1. In the ./tests/scratch/ directory create a file named hello.br.
  2. Open hello.br in a text editor and write the following:
fn my_main() -> i64 {
  project::std::io::write("Hello World\n");
  return 0;
}
  1. Go to ./tests/ and run ./make.sh -i ./scratch/hello.br. This will compile and execute hello.br

Using Thorn Insights

Requirements

  • Rust: Latest Stable Toolchain
  • NodeJS v16+

Building

Thorn insights consists of two components: the thorns server and the viewer. You run the thorns server from the root of your project directory and then start the viewer which will connect to thorns and let you explore your insight data.

Thorns

To install Thorns, clone the GitHub repository and go to the repo directory.

From there run the following:

cd thorns
cargo install --path .

This will create a release build of thorns and install it into the Rust binaries set.

Then go to your Bramble project root and run thorns. This will automatically host the insights data that has been output to ./target.

Viewer

After the you have started the thorns server. Go to the Thorns repository directory and:

cd viewer
npm start

This will start the React based Thorn Viewer, which will connect to thorns and let you interact with the insights data.


The Language

How to learn the language

Testing Bramble

How to test the compiler.