LicenseGPL-3
Safe HaskellSafe

Interpreter

Contents

Description

This module contains auxiliary logic, types and representations of the internal state of the interpreter.

Synopsis

Interpreter actions

data InterpreterAction Source #

Interpreter action. It can be a language action (binding and evaluation) or an interpreter specific one, such as "quit".

Constructors

Interpret Action

Language action

Quit

Close the interpreter

Load String

Load the given file

interpreteractionParser :: Parser InterpreterAction Source #

Parses an interpreter action.

act :: Action -> State Environment [String] Source #

Executes a language action. Given a context and an action, returns the new context after the action and a text output.

multipleAct :: [Action] -> State Environment [String] Source #

Executes multiple actions. Given a context and a set of actions, returns the new context after the sequence of actions and a text output.

data Action Source #

Language action. The language has a number of possible valid statements; all on the following possible forms.

Constructors

Bind (String, NamedLambda)

bind a name to an expression

EvalBind (String, NamedLambda)

bind a name to an expression and simplify it

Execute NamedLambda

execute an expression

Diagram NamedLambda

show the diagram of a lambda expression

SimpDiagram NamedLambda

show the diagram of the simplified expression

Comment

comment

EmptyLine

empty line, it will be ignored

Error

error on the interpreter

Restart

restarts the environment

Help

shows help

SetVerbose Bool

changes verbosity

SetColor Bool

changes colors

SetSki Bool

changes ski output

SetTypes Bool

changes type configuration

SetTopo Bool 

actionParser :: Parser Action Source #

Parses a language action.

executeWithEnv :: Environment -> String -> (String, Environment) Source #

Execute a block of code in a given environment

librariesEnv :: Environment Source #

Default environment plus standard libraries

preformat :: String -> String Source #

Preformats text before sending it to the interpreter