pcf-0.1.0.1: A one file compiler for PCF

Safe HaskellNone
LanguageHaskell2010

Language.Pcf

Synopsis

Documentation

data Ty Source

Constructors

Arr Ty Ty 
Nat 

Instances

Eq Ty 

data Exp a Source

Constructors

V a 
App (Exp a) (Exp a) 
Ifz (Exp a) (Exp a) (Scope () Exp a) 
Lam Ty (Scope () Exp a) 
Fix Ty (Scope () Exp a) 
Suc (Exp a) 
Zero 

compile :: Exp Integer -> Maybe CTranslUnit Source

Given an expression where free variables are integers, convert it to C. This function doesn't include all of the runtime system in the translation unit which makes it unsuitable for running all on its own. It's primarly for inspecting the copmiled result of a given expression.

output :: Exp Integer -> IO (Maybe String) Source

Compiles ane expression using compile. If we can compile program this function returns an Just s action which returns this where s is a runnable C program which outputs the result. If there was a type error, this gives back Nothing.