License | GPL-3 |
---|---|
Safe Haskell | Safe |
Interpreter
Contents
Description
This module contains auxiliary logic, types and representations of the internal state of the interpreter.
- data InterpreterAction
- interpreteractionParser :: Parser InterpreterAction
- act :: Action -> State Environment [String]
- multipleAct :: [Action] -> State Environment [String]
- data Action
- = Bind (String, NamedLambda)
- | EvalBind (String, NamedLambda)
- | Execute NamedLambda
- | Diagram NamedLambda
- | SimpDiagram NamedLambda
- | Comment
- | EmptyLine
- | Error
- | Restart
- | Help
- | SetVerbose Bool
- | SetColor Bool
- | SetSki Bool
- | SetTypes Bool
- | SetTopo Bool
- actionParser :: Parser Action
- executeWithEnv :: Environment -> String -> (String, Environment)
- librariesEnv :: Environment
- preformat :: String -> String
Interpreter actions
data InterpreterAction Source #
Interpreter action. It can be a language action (binding and evaluation) or an interpreter specific one, such as "quit".
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.
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