drasil-lang-0.1.60.0: A framework for code and document generation for scientific software - Language SubPackage
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Drasil.CodeExpr.Lang

Synopsis

Operators (mostly binary)

data ArithBinOp Source #

Arithmetic operators (fractional, power, and subtraction).

Constructors

Frac 
Pow 
Subt 

Instances

Instances details
Eq ArithBinOp Source # 
Instance details

Defined in Language.Drasil.CodeExpr.Lang

data EqBinOp Source #

Equality operators (equal or not equal).

Constructors

Eq 
NEq 

Instances

Instances details
Eq EqBinOp Source # 
Instance details

Defined in Language.Drasil.CodeExpr.Lang

Methods

(==) :: EqBinOp -> EqBinOp -> Bool #

(/=) :: EqBinOp -> EqBinOp -> Bool #

data BoolBinOp Source #

Conditional and Biconditional operators (Expressions can imply one another, or exist if and only if another expression exists).

Constructors

Impl 
Iff 

Instances

Instances details
Eq BoolBinOp Source # 
Instance details

Defined in Language.Drasil.CodeExpr.Lang

data LABinOp Source #

Index operator.

Constructors

Index 

Instances

Instances details
Eq LABinOp Source # 
Instance details

Defined in Language.Drasil.CodeExpr.Lang

Methods

(==) :: LABinOp -> LABinOp -> Bool #

(/=) :: LABinOp -> LABinOp -> Bool #

data OrdBinOp Source #

Ordered binary operators (less than, greater than, less than or equal to, greater than or equal to).

Constructors

Lt 
Gt 
LEq 
GEq 

Instances

Instances details
Eq OrdBinOp Source # 
Instance details

Defined in Language.Drasil.CodeExpr.Lang

data VVVBinOp Source #

Vector x Vector -> Vector binary operations (cross product, vector addition, vector sub).

Constructors

Cross 
VAdd 
VSub 

Instances

Instances details
Eq VVVBinOp Source # 
Instance details

Defined in Language.Drasil.CodeExpr.Lang

data VVNBinOp Source #

Vector x Vector -> Number binary operations (dot product).

Constructors

Dot 

Instances

Instances details
Eq VVNBinOp Source # 
Instance details

Defined in Language.Drasil.CodeExpr.Lang

data NVVBinOp Source #

Number x Vector -> Vector binary operations (scaling).

Constructors

Scale 

Instances

Instances details
Eq NVVBinOp Source # 
Instance details

Defined in Language.Drasil.CodeExpr.Lang

data AssocArithOper Source #

Associative operators (adding and multiplication). Also specifies whether it is for integers or for real numbers.

Constructors

AddI 
AddRe 
MulI 
MulRe 

Instances

Instances details
Eq AssocArithOper Source # 
Instance details

Defined in Language.Drasil.CodeExpr.Lang

data AssocBoolOper Source #

Associative boolean operators (and, or).

Constructors

And 
Or 

Instances

Instances details
Eq AssocBoolOper Source # 
Instance details

Defined in Language.Drasil.CodeExpr.Lang

data UFunc Source #

Unary functions (abs, log, ln, sin, etc.).

Constructors

Abs 
Log 
Ln 
Sin 
Cos 
Tan 
Sec 
Csc 
Cot 
Arcsin 
Arccos 
Arctan 
Exp 
Sqrt 
Neg 

Instances

Instances details
Eq UFunc Source # 
Instance details

Defined in Language.Drasil.CodeExpr.Lang

Methods

(==) :: UFunc -> UFunc -> Bool #

(/=) :: UFunc -> UFunc -> Bool #

data UFuncB Source #

Bool -> Bool operators.

Constructors

Not 

Instances

Instances details
Eq UFuncB Source # 
Instance details

Defined in Language.Drasil.CodeExpr.Lang

Methods

(==) :: UFuncB -> UFuncB -> Bool #

(/=) :: UFuncB -> UFuncB -> Bool #

data UFuncVV Source #

Vector -> Vector operators.

Constructors

NegV 

Instances

Instances details
Eq UFuncVV Source # 
Instance details

Defined in Language.Drasil.CodeExpr.Lang

Methods

(==) :: UFuncVV -> UFuncVV -> Bool #

(/=) :: UFuncVV -> UFuncVV -> Bool #

data UFuncVN Source #

Vector -> Number operators.

Constructors

Norm 
Dim 

Instances

Instances details
Eq UFuncVN Source # 
Instance details

Defined in Language.Drasil.CodeExpr.Lang

Methods

(==) :: UFuncVN -> UFuncVN -> Bool #

(/=) :: UFuncVN -> UFuncVN -> Bool #

CodeExpr

data CodeExpr where Source #

Expression language where all terms also denote a term in GOOL (i.e. translation is total and meaning preserving).

Constructors

Lit :: Literal -> CodeExpr

Brings literals into the expression language.

AssocA :: AssocArithOper -> [CodeExpr] -> CodeExpr

Takes an associative arithmetic operator with a list of expressions.

AssocB :: AssocBoolOper -> [CodeExpr] -> CodeExpr

Takes an associative boolean operator with a list of expressions.

C :: UID -> CodeExpr

C stands for Chunk, for referring to a chunk in an expression. Implicitly assumes that the chunk has a symbol.

FCall :: UID -> [CodeExpr] -> [(UID, CodeExpr)] -> CodeExpr

A function call accepts a list of parameters and a list of named parameters. For example

  • F(x) is (FCall F [x] []).
  • F(x,y) would be (FCall F [x,y]).
  • F(x,n=y) would be (FCall F [x] [(n,y)]).
New :: UID -> [CodeExpr] -> [(UID, CodeExpr)] -> CodeExpr

Actor creation given UID, parameters, and named parameters.

Message :: UID -> UID -> [CodeExpr] -> [(UID, CodeExpr)] -> CodeExpr

Message an actor:

  • 1st UID is the actor,
  • 2nd UID is the method.
Field :: UID -> UID -> CodeExpr

Access a field of an actor:

  • 1st UID is the actor,
  • 2nd UID is the field.
Case :: Completeness -> [(CodeExpr, CodeExpr)] -> CodeExpr

For multi-case expressions, each pair represents one case.

Matrix :: [[CodeExpr]] -> CodeExpr

Represents a matrix of expressions.

UnaryOp :: UFunc -> CodeExpr -> CodeExpr

Unary operation for most functions (eg. sin, cos, log, etc.).

UnaryOpB :: UFuncB -> CodeExpr -> CodeExpr

Unary operation for Bool -> Bool operations.

UnaryOpVV :: UFuncVV -> CodeExpr -> CodeExpr

Unary operation for Vector -> Vector operations.

UnaryOpVN :: UFuncVN -> CodeExpr -> CodeExpr

Unary operation for Vector -> Number operations.

ArithBinaryOp :: ArithBinOp -> CodeExpr -> CodeExpr -> CodeExpr

Binary operator for arithmetic between expressions (fractional, power, and subtraction).

BoolBinaryOp :: BoolBinOp -> CodeExpr -> CodeExpr -> CodeExpr

Binary operator for boolean operators (implies, iff).

EqBinaryOp :: EqBinOp -> CodeExpr -> CodeExpr -> CodeExpr

Binary operator for equality between expressions.

LABinaryOp :: LABinOp -> CodeExpr -> CodeExpr -> CodeExpr

Binary operator for indexing two expressions.

OrdBinaryOp :: OrdBinOp -> CodeExpr -> CodeExpr -> CodeExpr

Binary operator for ordering expressions (less than, greater than, etc.).

VVVBinaryOp :: VVVBinOp -> CodeExpr -> CodeExpr -> CodeExpr

Binary operator for Vector x Vector -> Vector operations (cross product).

VVNBinaryOp :: VVNBinOp -> CodeExpr -> CodeExpr -> CodeExpr

Binary operator for Vector x Vector -> Number operations (dot product).

NVVBinaryOp :: NVVBinOp -> CodeExpr -> CodeExpr -> CodeExpr

Binary operator for Number x Vector -> Vector operations (scaling).

Operator :: AssocArithOper -> DiscreteDomainDesc CodeExpr CodeExpr -> CodeExpr -> CodeExpr

Operators are generalized arithmetic operators over a DomainDesc of an Expr. Could be called BigOp. ex: Summation is represented via Add over a discrete domain.

RealI :: UID -> RealInterval CodeExpr CodeExpr -> CodeExpr

The expression is an element of a space. IsIn :: Expr -> Space -> Expr | A different kind of IsIn. A UID is an element of an interval.

Instances

Instances details
CodeExprC CodeExpr Source # 
Instance details

Defined in Language.Drasil.CodeExpr.Class

ExprC CodeExpr Source # 
Instance details

Defined in Language.Drasil.Expr.Class

Methods

lit :: Literal -> CodeExpr Source #

($=) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($!=) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($<) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($>) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($<=) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($>=) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($.) :: CodeExpr -> CodeExpr -> CodeExpr Source #

addI :: CodeExpr -> CodeExpr -> CodeExpr Source #

addRe :: CodeExpr -> CodeExpr -> CodeExpr Source #

mulI :: CodeExpr -> CodeExpr -> CodeExpr Source #

mulRe :: CodeExpr -> CodeExpr -> CodeExpr Source #

($-) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($/) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($^) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($=>) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($<=>) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($&&) :: CodeExpr -> CodeExpr -> CodeExpr Source #

($||) :: CodeExpr -> CodeExpr -> CodeExpr Source #

abs_ :: CodeExpr -> CodeExpr Source #

neg :: CodeExpr -> CodeExpr Source #

log :: CodeExpr -> CodeExpr Source #

ln :: CodeExpr -> CodeExpr Source #

sqrt :: CodeExpr -> CodeExpr Source #

sin :: CodeExpr -> CodeExpr Source #

cos :: CodeExpr -> CodeExpr Source #

tan :: CodeExpr -> CodeExpr Source #

sec :: CodeExpr -> CodeExpr Source #

csc :: CodeExpr -> CodeExpr Source #

cot :: CodeExpr -> CodeExpr Source #

arcsin :: CodeExpr -> CodeExpr Source #

arccos :: CodeExpr -> CodeExpr Source #

arctan :: CodeExpr -> CodeExpr Source #

exp :: CodeExpr -> CodeExpr Source #

dim :: CodeExpr -> CodeExpr Source #

norm :: CodeExpr -> CodeExpr Source #

negVec :: CodeExpr -> CodeExpr Source #

not_ :: CodeExpr -> CodeExpr Source #

idx :: CodeExpr -> CodeExpr -> CodeExpr Source #

defint :: Symbol -> CodeExpr -> CodeExpr -> CodeExpr -> CodeExpr Source #

defsum :: Symbol -> CodeExpr -> CodeExpr -> CodeExpr -> CodeExpr Source #

defprod :: Symbol -> CodeExpr -> CodeExpr -> CodeExpr -> CodeExpr Source #

realInterval :: HasUID c => c -> RealInterval CodeExpr CodeExpr -> CodeExpr Source #

euclidean :: [CodeExpr] -> CodeExpr Source #

cross :: CodeExpr -> CodeExpr -> CodeExpr Source #

vScale :: CodeExpr -> CodeExpr -> CodeExpr Source #

vAdd :: CodeExpr -> CodeExpr -> CodeExpr Source #

vSub :: CodeExpr -> CodeExpr -> CodeExpr Source #

completeCase :: [(CodeExpr, CodeExpr)] -> CodeExpr Source #

incompleteCase :: [(CodeExpr, CodeExpr)] -> CodeExpr Source #

matrix :: [[CodeExpr]] -> CodeExpr Source #

apply :: (HasUID f, HasSymbol f) => f -> [CodeExpr] -> CodeExpr Source #

sy :: (HasUID c, HasSymbol c) => c -> CodeExpr Source #

LiteralC CodeExpr Source # 
Instance details

Defined in Language.Drasil.CodeExpr.Lang