# Ivy

[Little lambdas eat ivy.][etymology]

[etymology]: https://en.wikipedia.org/wiki/Mairzy_Doats

Ivy is an impure functional language that compiles to native code. It was
developed as an educational project to learn more about compiling functional
languages, and compiling without going through frameworks like LLVM that handle
the backend. It currently supports x64, and requires clang as an assembler.

## Setup

Running the compiler requires the Ivy runtime be on the linker search path.
Build the runtime:

```shell
$ cd rt
$ cargo build --release
```

And then you can either install `rt/target/release/libivy_rt.a` in your library
directory of choice, or run the compiler in the Ivy project root directory via:

```shell
$ env LIBRARY_PATH=rt/target/release cargo run --release
```

As a shortcut for running a program, you can use `tools/run.py` which will
compile and run a source file directly (handling the library path for you),
while simultaneously doing pretty-printing of debug output.

To get pretty-printed debug output on a compiled binary, use `tools/trace.py`
to run it.

## Testing

You can use `tools/test.py` to run all of the project tests. It will ensure
that the compiler and runtime are properly built before running any filetests.

Filetests are written to be run by `tools/lit.py`, and checked with
`filecheck`. See filetests in the `tests/` directory for examples.

Recommended `.git/hooks/pre-commit` script:
```bash
#!/bin/bash
set -e
tools/test.py
```
