scratch-clone-2022.0.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language

Description

This module contains the types for the abstract syntax tree.

Synopsis

Documentation

type Program = [Stmt] Source #

A program consists of a sequence of statements.

data Stmt Source #

A program is a sequence of statements.

Constructors

AssignStmt 
IfStmt 

Fields

RepeatStmt 

Instances

Instances details
Show Stmt Source # 
Instance details

Defined in Language

Methods

showsPrec :: Int -> Stmt -> ShowS #

show :: Stmt -> String #

showList :: [Stmt] -> ShowS #

data Op Source #

Operators.

Constructors

Add

The + operator.

Sub

The - operator.

Mul

The * operator.

Div

The / operator.

Pow

The power of operator.

Equal

The == operator.

Neq

The /= operator.

LessThan

The < operator.

LessOrEqual

The <= operator.

GreaterThan

The > operator.

GreaterOrEqual

The >= operator.

Instances

Instances details
Bounded Op Source # 
Instance details

Defined in Language

Methods

minBound :: Op #

maxBound :: Op #

Enum Op Source # 
Instance details

Defined in Language

Methods

succ :: Op -> Op #

pred :: Op -> Op #

toEnum :: Int -> Op #

fromEnum :: Op -> Int #

enumFrom :: Op -> [Op] #

enumFromThen :: Op -> Op -> [Op] #

enumFromTo :: Op -> Op -> [Op] #

enumFromThenTo :: Op -> Op -> Op -> [Op] #

Eq Op Source # 
Instance details

Defined in Language

Methods

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

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

Show Op Source # 
Instance details

Defined in Language

Methods

showsPrec :: Int -> Op -> ShowS #

show :: Op -> String #

showList :: [Op] -> ShowS #

data Expr Source #

Expressions.

Constructors

ValE Int 
VarE String 
BinOpE Op Expr Expr 

Instances

Instances details
Show Expr Source # 
Instance details

Defined in Language

Methods

showsPrec :: Int -> Expr -> ShowS #

show :: Expr -> String #

showList :: [Expr] -> ShowS #