language-qux-0.1.1.3: Utilities for working with the Qux language

Copyright(c) Henry J. Wylde, 2015
LicenseBSD3
Maintainerpublic@hjwylde.com
Safe HaskellSafe
LanguageHaskell2010

Language.Qux.Syntax

Contents

Description

Abstract syntax tree nodes.

Synopsis

Documentation

type Id = String Source

An identifier.

Nodes

newtype Program Source

A program is a list of declarations.

Constructors

Program [Decl] 

data Decl Source

A declaration.

Constructors

FunctionDecl Id [(Type, Id)] [Stmt]

A name, list of (Type, Id) parameters and statements. The return type is treated as a parameter with id "@".

data Stmt Source

A statement.

Constructors

IfStmt Expr [Stmt] [Stmt]

A condition, true block and false block of statements.

ReturnStmt Expr

An expression.

WhileStmt Expr [Stmt]

A condition and block of statements.

data Expr Source

A complex expression.

Constructors

ApplicationExpr Id [Expr]

A function name to call and the arguments to pass.

BinaryExpr BinaryOp Expr Expr

A binary operation.

ListExpr [Expr]

A list of expressions.

UnaryExpr UnaryOp Expr

A unary oepration.

ValueExpr Value

A raw value.

data BinaryOp Source

A binary operator.

Constructors

Acc 
Mul 
Div 
Mod 
Add 
Sub 
Lt 
Lte 
Gt 
Gte 
Eq 
Neq 

data UnaryOp Source

A unary operator.

Constructors

Len 
Neg 

data Value Source

A value is considered to be in it's normal form.

Constructors

BoolValue Bool

A boolean.

IntValue Integer

An unbounded integer.

ListValue [Value]

A normalised list of values.

NilValue

A unit value.

data Type Source

A type.

Constructors

BoolType 
IntType 
ListType Type

A list type with an inner type.

NilType