Page
Library
Module
Module type
Parameter
Class
Class type
Source
Interpreter for SiFun (Simple Functional) Language with three different type systems (supports Higher-Rank Polymorphism).
Currently supports Hindley–Milner type system (simply typed lambda calculus) and Hindley–Milner with Visible Type Application (similar to System F).
Under development is a Bidirectional Typechecking System which will support Higher-Rank Polymorphism without typed function and type application.
You can clone this repository using:
git clone git@github.com:kkd26/SiFun.git
cd SiFun
opam install .
or use the official opam release using:
opam install sifun
There are two ways to interact with the interpreter:
SiFun REPL (Read–eval–print loop) - interactive console
sifuni
SiFun Interpreter - run from file
sifun <filename>
The basic language supports (similar to Hindley–Milner type system):
1
, 2
, 3
, ...true
, false
x
, y
, ...(1, true)
fst (1,3)
, snd (4,5)
, ...fn x => x
, fn x => fn y => (x,y)
, ...(fn x => (1,x)) 2
, ...The additional features are (similar to System F):
fn x : int => x
, ...a
, b
, c
, ...forall a. a->a
, forall a b c. a->b->c
, ...lam a. (int, fn x : a => x)
, lam a b c. fn x : a => x
, ...(lam a. fn x : a => x) {int}
, ...Note that ;
separates blocks of code and ;;
sends EOF, so stops execution.
You can check ./examples
for more information about the syntax and semantics.