ddc-core-flow-0.3.2.1: Disciplined Disciple Compiler data flow compiler.

Safe HaskellNone

DDC.Core.Flow.Prim

Contents

Synopsis

Names and lexing

data Name Source

Names of things used in Disciple Core Flow.

Constructors

NameVar String

User defined variables.

NameVarMod Name String

A name generated by modifying some other name `name$mod`

NameCon String

A user defined constructor.

NameKiConFlow KiConFlow

Fragment specific kind constructors.

NameTyConFlow TyConFlow

Fragment specific type constructors.

NameDaConFlow DaConFlow

Fragment specific data constructors.

NameOpFlow OpFlow

Flow operators.

NameOpLoop OpLoop

Loop operators.

NameOpStore OpStore

Store operators.

NamePrimTyCon PrimTyCon

A primitive type constructor.

NamePrimArith PrimArith

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

NamePrimCast PrimCast

Primitive casting between numeric types.

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.

Fragment specific kind constructors

data KiConFlow Source

Fragment specific kind constructors.

Constructors

KiConFlowRate 

readKiConFlow :: String -> Maybe KiConFlowSource

Read a kind constructor name.

Fragment specific type constructors

data TyConFlow Source

Fragment specific type constructors.

Constructors

TyConFlowTuple Int

TupleN# constructor. Tuples.

TyConFlowVector

Vector# constructor. Vectors.

TyConFlowSeries

Series# constructor. Series types.

TyConFlowSegd

Segd# constructor. Segment Descriptors.

TyConFlowSel Int

SelN# constructor. Selectors.

TyConFlowRef

Ref# constructor. References.

TyConFlowWorld

World# constructor. State token used when converting to GHC core.

TyConFlowRateNat

RateNat# constructor. Naturals witnessing a type-level Rate.

readTyConFlow :: String -> Maybe TyConFlowSource

Read a type constructor name.

kindTyConFlow :: TyConFlow -> Kind NameSource

Yield the kind of a primitive type constructor.

Fragment specific data constructors

data DaConFlow Source

Primitive data constructors.

Constructors

DaConFlowTuple Int

TN data constructor.

readDaConFlow :: String -> Maybe DaConFlowSource

Read a data constructor name.

typeDaConFlow :: DaConFlow -> Type NameSource

Yield the type of a data constructor.

Flow operators

readOpFlow :: String -> Maybe OpFlowSource

Read a data flow operator name.

typeOpFlow :: OpFlow -> Type NameSource

Yield the type of a data flow operator, or error if there isn't one.

Loop operators

data OpLoop Source

Loop operators.

readOpLoop :: String -> Maybe OpLoopSource

Read a loop operator name.

typeOpLoop :: OpLoop -> Type NameSource

Yield the type of a loop operator.

Store operators

data OpStore Source

Store operators.

Constructors

OpStoreNew

Allocate a new reference.

OpStoreRead

Read from a reference.

OpStoreWrite

Write to a reference.

OpStoreNewVector

Allocate a new vector (taking a Nat for the length)

OpStoreNewVectorR

Allocate a new vector (taking a Rate for the length)

OpStoreNewVectorN

Allocate a new vector (taking a RateNat for the length)

OpStoreReadVector

Read from a vector.

OpStoreWriteVector

Write to a vector.

OpStoreSliceVector

Slice after a pack/filter (taking a Nat for new length)

OpStoreNext

Take the next element from a series.

readOpStore :: String -> Maybe OpStoreSource

Read a store operator name.

typeOpStore :: OpStore -> Type NameSource

Yield the type of a store operator.

Primitive type constructors

data PrimTyCon

Primitive type constructors.

Constructors

PrimTyConVoid

Void# the Void type has no values.

PrimTyConBool

Bool# unboxed booleans.

PrimTyConNat

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

PrimTyConInt

Int# signed integers.

PrimTyConWord Int

WordN# machine words of the given width.

PrimTyConFloat Int

FloatN# floating point numbers of the given width.

PrimTyConTag

Tag# data constructor tags.

PrimTyConAddr

Addr# raw machine addresses. Unlike pointers below, a raw Addr# need not to refer to memory owned by the current process.

PrimTyConPtr

Ptr# should point to a well-formed object owned by the current process.

PrimTyConString

String# of UTF8 characters.

These are primitive until we can define our own unboxed types.

kindPrimTyCon :: PrimTyCon -> Kind NameSource

Yield the kind of a type constructor.

Primitive arithmetic operators

data PrimArith

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

PrimArithNeg

Negation

PrimArithAdd

Addition

PrimArithSub

Subtraction

PrimArithMul

Multiplication

PrimArithDiv

Division

PrimArithMod

Modulus

PrimArithRem

Remainder

PrimArithEq

Equality

PrimArithNeq

Negated Equality

PrimArithGt

Greater Than

PrimArithGe

Greater Than or Equal

PrimArithLt

Less Than

PrimArithLe

Less Than or Equal

PrimArithAnd

Boolean And

PrimArithOr

Boolean Or

PrimArithShl

Shift Left

PrimArithShr

Shift Right

PrimArithBAnd

Bit-wise And

PrimArithBOr

Bit-wise Or

PrimArithBXOr

Bit-wise eXclusive Or

typePrimArith :: PrimArith -> Type NameSource

Take the type of a primitive arithmetic operator.

Casting between primitive types

data PrimCast

Primitive cast between two types.

The exact set of available casts is determined by the target platform. For example, you can only promote a Nat# to a Word32# on a 32-bit system. On a 64-bit system the Nat# type is 64-bits wide, so casting it to a Word32# would be a truncation.

Constructors

PrimCastPromote

Promote a value to one of similar or larger width, without loss of precision.

PrimCastTruncate

Truncate a value to a new width, possibly losing precision.

typePrimCast :: PrimCast -> Type NameSource

Take the type of a primitive cast.