Skip to content
forked from sampsyo/bril

an educational compiler intermediate representation

License

Notifications You must be signed in to change notification settings

tigregalis/bril

This branch is 342 commits behind sampsyo/bril:main.

Folders and files

NameName
Last commit message
Last commit date
May 22, 2024
Jul 8, 2024
Sep 6, 2023
Jan 28, 2022
Mar 23, 2021
Jun 17, 2024
Jun 24, 2021
Feb 1, 2024
Jun 2, 2023
Aug 26, 2021
Jun 17, 2024
May 7, 2024
Mar 4, 2024
Jun 10, 2023
Jan 6, 2024
May 17, 2024
Aug 26, 2020
Aug 30, 2023
Sep 3, 2019
May 26, 2023
Jul 8, 2022
Feb 9, 2022
Sep 8, 2023
Sep 9, 2023
Sep 10, 2023

Repository files navigation

Bril: A Compiler Intermediate Representation for Learning

Bril (the Big Red Intermediate Language) is a compiler IR made for teaching CS 6120, a grad compilers course. It is an extremely simple instruction-based IR that is meant to be extended. Its canonical representation is JSON, which makes it easy to build tools from scratch to manipulate it.

This repository contains the documentation, including the language reference document, and some infrastructure for Bril. There are some quick-start instructions below for some of the main tools, but check out the docs for more details about what's available.

Install the Tools

Reference Interpreter

You will want the IR interpreter, which uses Deno. Just type this:

$ deno install brili.ts

As Deno tells you, you will then need to add $HOME/.deno/bin to your $PATH. You will then have brili, which takes a Bril program as JSON on stdin and executes it.

Text Format

The parser & pretty printer for the human-editable text form of Bril are written for Python 3. To install them, you need Flit, so run this:

$ pip install --user flit

Then, go to the bril-txt directory and use Flit to install symlinks to the tools:

$ flit install --symlink --user

The tools are called bril2json and bril2txt. They also take input on stdin and produce output on stdout.

Tests

There are some tests in the test/ directory. They use Turnt, which lets us write the expected output for individual commands. Install it with pip:

$ pip install --user turnt

Then run all the tests by typing make test.

About

an educational compiler intermediate representation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 39.2%
  • C 18.6%
  • C++ 14.8%
  • TypeScript 9.4%
  • Python 8.0%
  • OCaml 3.7%
  • Other 6.3%