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

Safe HaskellNone

DDC.Core.Tetra.Prim

Contents

Synopsis

Names and lexing.

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.

readName :: String -> Maybe NameSource

Read the name of a variable, constructor or literal.

Primitive type constructors.

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.

kindTyConPrim :: TyConPrim -> Kind NameSource

Yield the kind of a type constructor.

Primitive arithmetic operators.

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

typeOpPrimArith :: OpPrimArith -> Type NameSource

Take the type of a primitive arithmetic operator.

Mutable references.

data OpPrimRef Source

Mutable References.

Constructors

OpPrimRefAllocRef

Allocate a reference.

OpPrimRefReadRef

Read a reference.

OpPrimRefWriteRef

Write to a reference.

typeOpPrimRef :: OpPrimRef -> Type NameSource

Take the type of a primitive arithmetic operator.