AnyDSL / artic

The AlteRnaTive Impala Compiler
MIT License
25 stars 6 forks source link
compiler domain-specific-languages functional-programming-language gpu-computing imperative-programming-language parallel-computing partial-evaluation simd vectorization

build-and-test

The AlteRnaTive Impala Compiler.

Building

A compiler that supports C++17 and CMake are required to build the project. Additionally, this project depends on Thorin. Use the following commands to build the program:

mkdir build
cd build
cmake .. -DThorin_DIR=<path/to/thorin>
make -j

Note that path/to/thorin is usually thorin/build/share/anydsl/cmake.

Status

Artic is in alpha stage, which means that it should be able to compile any valid program. There might still be bugs lurking in, and if you find one, please report it on the issues tab, preferably with a minimal reproducing example.

Testing

Once built, Artic can be run with the following command:

bin/artic [files]

The test suite can be run using:

make test

Additionally, a coverage report can be generated when the CODE_COVERAGE CMake variable is set to ON or TRUE:

make coverage

Documentation

The documentation for the compiler internals can be found here.

Syntax

The syntax follows that of Impala, whenever possible. Some notable changes compared to the syntax of Impala are:

implicit = Len[Vec3f] { len = | v | sqrt(v.x v.x + v.y v.y + v.z * v.z) }; fn longest(a: Vec3f, b: Vec3f, implicit l: Len[Vec3f]) = if (l.len(a) > l.len(b)) { a } else { b };

 - The type inference algorithm is now bidirectional type checking, which means
   that type information is propagated _locally_, not globally. This gives improved
   error messages and better support for advanced type system features, at the cost
   of slightly more type annotations:
```rust
let x = |i| i; // artic needs a type annotation on `i` or on `x`
x(1) // impala would see this as a constraint that `x` is a function on integers