mini-go-0.3.0.0: Mini Go parser and interpreter
Safe HaskellSafe-Inferred
LanguageHaskell2010

Analyzer.Result

Description

This module contains types and functions needed for representing analysis result.

Synopsis

Analysis result

type Result a = ExceptT Err (State Env) a Source #

Represents the result of analysis.

Result value

type ResultValue = Either Err Source #

Result value (in other words, it is stateless Result).

data Err Source #

Represents an unsuccessful analysis.

Constructors

NoMain

No entry point for the interpreter error.

IdentifierNotFound Identifier

Identifier not found error.

IdentifierRedeclaration Identifier

Identifier redeclaration error.

MismatchedTypes

Mismatched types error.

NotInIntBounds

Constant integer expression not in int bounds error.

DivisionByZero

Division by 0 in constant integer expression error.

BreakOrContinueOutsideOfForScope

break or continue statement used outside of ForScope error.

Instances

Instances details
Show Err Source # 
Instance details

Defined in Analyzer.Result

Methods

showsPrec :: Int -> Err -> ShowS #

show :: Err -> String #

showList :: [Err] -> ShowS #

State

Environment

newtype Env Source #

Analyzer environment.

Constructors

Env 

Fields

Instances

Instances details
Show Env Source # 
Instance details

Defined in Analyzer.Result

Methods

showsPrec :: Int -> Env -> ShowS #

show :: Env -> String #

showList :: [Env] -> ShowS #

emptyEnv :: Env Source #

Create empty environment.

Scope

data Scope Source #

Scope contains identifiers mapped to their types.

Constructors

Scope 

Instances

Instances details
Show Scope Source # 
Instance details

Defined in Analyzer.Result

Methods

showsPrec :: Int -> Scope -> ShowS #

show :: Scope -> String #

showList :: [Scope] -> ShowS #

data ScopeType Source #

Scope type.

Constructors

ForScope 
OrdinaryScope 

Instances

Instances details
Show ScopeType Source # 
Instance details

Defined in Analyzer.Result

Eq ScopeType Source # 
Instance details

Defined in Analyzer.Result

scope :: ScopeType -> [(Identifier, Type)] -> Scope Source #

Create Scope from its type and elements.

emptyScope :: ScopeType -> Scope Source #

Create empty Scope from its type.

Optics