Skip to content

MiniHaskell compiler and interpreter with a Lucid-like dataflow IR

Notifications You must be signed in to change notification settings

georgesittas/minihaskell-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MiniHaskell Compiler

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

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.

Usage

# 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

Note

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.

Issues

The test suite is certainly not exhaustive, so please consider creating an issue if you find a bug.