etherforth_logo

Interpreter module

Interpreter processes user commands. It has a stack to keep parameters ready for a command, and it also has a small dictionary where commands are searched for. After a command has been executed, control is given back to Editor.

node 508 node 509 node 510 node 408 node 409 node 410 interpret module floorplan

Description

Interpreter waits until instructed by Editor module that a text entered into the command line is to be interpreted. The process starts in node 409, which requests SRAM to get 16 words from block zero (actually the command line content), and through node 408 receives strings of characters separated by spaces. It parses individual strings, converting numbers (in decimal or hex base) to binary form, and storing them on stack in node 509.

Non-numeric strings are considered commands, and are searched for in dictionary implemented in node 510. If a command is found there, corresponding code is executed in node 410. As a result, an action may be performed in Editor (such as opening a block for editing), in SRAM (for instance copying one block to another performed by node 109), or an ether message can be sent from node 508 to other modules, for example Compiler or MMC.

After the command has been executed, the command line is erased, and control is handed over back to Editor. In case a command is not recognized, Interpreter turns the offending string red before returning back.