Skip to content

Foundations-of-Decentralization-Group/Pirouette-Compiler

Repository files navigation

Install dependencies

opam install . --deps-only --with-test

Build pirc

dune build

Run tests

dune test

Build and execute

dune exec pirc -- [options] <file>

if it has been installed by dune install you can run it directly:

pirc [options] <file>

E.g.:

cd examples
dune exec pirc -- -ast-dump json 1.pir
pirc -ast-dump json 2.pir

Then pirc will parse the file and dump the ASTs to the current directory (in pretty-printed format by default).

Options

  • -ast-dump <pprint|json>: Dump the AST in pretty-printed or JSON format.

  • use - to read the source code from stdin. E.g.:

cat examples/1.pir | dune exec pirc -- -

Pipeline Testing

Tests are added by placing .pir and .ans files in test/test_src, then running dune test in the root directory. The test runner will compile the .pir file, run the compiled program, and compare the output to the .ans file. If the output matches the .ans file, the test passes.

Contribute