This is a comprehensive implementation of a compiler and interpreter for MiniHaskell, a small subset of Haskell. The MiniHaskell code is compiled into an intermediate representation called intensional code, which is then used as the source language for the execution process.
The goal for this project was to design, implement and grade the final assignment for the Programming Language Principles course, which is taught by prof. Panagiotis Rontogiannis in DiT (UoA). The assignment description is also included (in Greek).
Intensional code is a dataflow programming language inspired by Lucid, and has been described extensively in the paper "First-order functional languages and intensional logic", by P. Rontogiannis, W. W. Wadge.
# Install Haskell via GHCup
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
# Install dependencies
cabal install --lib parsec
cabal install --lib pretty-simple
# Expose packages so that linking works as expected
ghc-pkg expose parsec
ghc-pkg expose pretty
ghc-pkg expose mtl
# Compile the project
make
# Run the test suite
make tests
# Remove all generated files
make clean
As described in the related articles, this implementation could be made a lot more efficient. However, this was outside the project's scope, and hence the interpreter is expected to be rather slow. A faster implementation in Rust can be found here.
The test suite is certainly not exhaustive, so please consider creating an issue if you find a bug.