Parser for a simple subset of Haskell with time complexity annotations and dependency graphs.
This project uses Stack:
stack build # to build
stack run -- <args> # or ./hashkell-exe <args>, to run with <args>
stack test # to test
To parallelise an input file code.hs
with the func method:
stack run -- parallelise func code.hs
To graph all the functions in an input file code.hs
:
stack run -- graph -A code.hs
For all options, refer to the help manual:
stack run -- --help
fib ## 2^x;
fib :: Int -> Int;
fib x =
if x < 1
then 0
else if x < 2
then 1
else fib (x - 1) + fib (x - 2)
Time complexity annotations are used by the compiler to generate branching paths for parallelisation.
Annotations are written using ##
, as so:
<function-name> ## <time-complexity>;
The following annotations are supported:
-- Constant time
func ## 1;
-- Polynomial time
func ## n;
func ## n^2;
func ## n^100;
-- Exponential time
func ## 2^n;
func ## 100^n;
-- Logarithmic time
func ## log n;
-- Factorial time
func ## fac n;
The given identifier name in the annotation must correspond to an argument in the function declaration, and only one such name is allowed in any annotation.