ddc-core-tetra-0.3.2.1: Disciplined Disciple Compiler intermediate language.

Safe HaskellNone

DDC.Core.Tetra

Contents

Synopsis

Language profile

profile :: Profile NameSource

Language profile for Disciple Core Flow.

Names

data Name Source

Names of things used in Disciple Core Tetra.

Constructors

NameVar String

User defined variables.

NameCon String

A user defined constructor.

NameTyConPrim TyConPrim

A primitive type constructor.

NameOpPrimArith OpPrimArith

Primitive arithmetic, logic, comparison and bit-wise operators.

NameOpPrimRef OpPrimRef

Mutable references.

NameLitBool Bool

A boolean literal.

NameLitNat Integer

A natural literal.

NameLitInt Integer

An integer literal.

NameLitWord Integer Int

A word literal.

data TyConPrim Source

Primitive type constructors.

Constructors

TyConPrimBool

Bool unboxed booleans.

TyConPrimNat

Nat natural numbers. Big enough to count every addressable byte in the store.

TyConPrimInt

Int signed integers.

TyConPrimWord Int

WordN machine words of the given width.

TyConPrimRef

A mutable reference.

data OpPrimArith Source

Primitive arithmetic, logic, and comparison opretors. We expect the backend/machine to be able to implement these directly.

For the Shift Right operator, the type that it is used at determines whether it is an arithmetic (with sign-extension) or logical (no sign-extension) shift.

Constructors

OpPrimArithNeg

Negation

OpPrimArithAdd

Addition

OpPrimArithSub

Subtraction

OpPrimArithMul

Multiplication

OpPrimArithDiv

Division

OpPrimArithMod

Modulus

OpPrimArithRem

Remainder

OpPrimArithEq

Equality

OpPrimArithNeq

Negated Equality

OpPrimArithGt

Greater Than

OpPrimArithGe

Greater Than or Equal

OpPrimArithLt

Less Than

OpPrimArithLe

Less Than or Equal

OpPrimArithAnd

Boolean And

OpPrimArithOr

Boolean Or

OpPrimArithShl

Shift Left

OpPrimArithShr

Shift Right

OpPrimArithBAnd

Bit-wise And

OpPrimArithBOr

Bit-wise Or

OpPrimArithBXOr

Bit-wise eXclusive Or

data OpPrimRef Source

Mutable References.

Constructors

OpPrimRefAllocRef

Allocate a reference.

OpPrimRefReadRef

Read a reference.

OpPrimRefWriteRef

Write to a reference.

Name Parsing

readName :: String -> Maybe NameSource

Read the name of a variable, constructor or literal.

Program Lexing

lexModuleString :: String -> Int -> String -> [Token (Tok Name)]Source

Lex a string to tokens, using primitive names.

The first argument gives the starting source line number.

lexExpString :: String -> Int -> String -> [Token (Tok Name)]Source

Lex a string to tokens, using primitive names.

The first argument gives the starting source line number.