src/repl/evaluator

Search:
Group by:
Source   Edit  

Types

Evaluator = object
Source   Edit  

Procs

proc eval(self: var Evaluator; input: Input): Evaluation {.
    ...raises: [KeyError, Exception], tags: [RootEffect], forbids: [].}

Evaluates the given input, returning an Evaluation object.

`Lines`: If the input kind is Lines, the lines are evaluated as declarations, nim code, or built-in commands from the commands table. Evaluating to what the declaration, nim code, or built-in command evaluate to.

`Reset`: a reset input will clear the current line and start a new one. It evaluates to an Empty evaluation. `Quit` and `EOF`: both will be evaluated to a Quit evaluation, exiting the REPL.

Source   Edit  
proc newEvaluator(commandsApi: CommandsApi; commands: Table[string, Command];
                  vm: Vm): Evaluator {....raises: [], tags: [], forbids: [].}

Creates a new Evaluator object with the given commands and VM.

Commands: commands is a table associating built-in command names with their implementations. The commandsApi object contains the output, compiler and vm exposed to each command.

Vm: vm is the Vm object that contains the state, declarations, imports, and runs nim code.

Source   Edit