core-compiler-0.1.0.2: compile your own mini functional language with Core

Safe HaskellSafe
LanguageHaskell2010

Core.Grammar

Synopsis

Documentation

type CoreExpr = Expr Name Source #

A Core expression

data Expr a Source #

AST of the Core language

Constructors

EVar Name

a variable

ENum Int

an Int

EConstr Int Int [Expr a]

a type declaration

EAp (Expr a) (Expr a)

function application

ELet Bool [(a, Expr a)] (Expr a)

let/letrec expression

ECase (Expr a) [Alter a]

case expression

ELam [a] (Expr a)

lambda expression (not yet implemented)

Instances

Eq a => Eq (Expr a) Source # 

Methods

(==) :: Expr a -> Expr a -> Bool #

(/=) :: Expr a -> Expr a -> Bool #

Show a => Show (Expr a) Source # 

Methods

showsPrec :: Int -> Expr a -> ShowS #

show :: Expr a -> String #

showList :: [Expr a] -> ShowS #

type CoreAlt = Alter Name Source #

a case alternative

type Alter a = (Int, [a], Expr a) Source #

a case alternative for a given datatype contains the datatype id a list of local variable names the expression that the case evaluates to

type CoreProgram = Program Name Source #

A list of super combinator definitions

type Program a = [ScDefn a] Source #

a list of supercombinator definitions

type CoreScDefn = ScDefn Name Source #

A supercombinator definition

type ScDefn a = (Name, [a], Expr a) Source #

contains the name of the function/global the list of local variable names the expression the supercombinator evaluates to