In the previous chapter the interpreter was run with a program and also in edit mode. To develop programs you will want to run it in edit mode this will enable you to debug your programs quickly.
To run the interpretor in Edit mode run the evolve.exe file.
This next section covers all the commands available in the interpreter, you might want to skip parts of it and get on with writing some code.
To load the HelloWorld.e example the load command can be used
load <filename> loads the file with filename into the interpreter.
The file can then be run by typing 'go'.
If load is used without a file name then it brings up a basic file manager. For example
0. <..>
1. <project>
2. File formatter.e
3. Terminal.e
Path: c:\user\fred\evolve\✳.e
Menu >> r - Refresh f - filter p - path x - exit
The screen shows the current directory listing followed by the current path and filter, along the bottom is a menu showing the currently available commands.
To select a file or directory enter the number of the require file or directory followed by 'enter'. if you select a directory then the files in the new directory will be displayed if you select a file then it will be loaded into the interpreter.
'r' will refresh the directory.
'f' will let you enter a filter for the file if you want this to be only for evolve files then set it to *.e.
'p' lets you enter a new path or drive.
If you have a file loaded and then you edit it in an external editor then typing 'reload' will reload the currently loaded file.
Having to type 'reload' every time you edit your program is a bit annoying so there is an option to get the interpretor to automatically reload the file automatically when you type 'go' this is done by typing 'autoload on'. The file will then be reloaded every time you run it with the 'go' command. If you want to turn off the auto loading then type 'autoload off'.
The current file can be viewed by typing 'list' this will list the file with line numbers.
The interpreter has several commands to format the files.
format Adjusts the indentation of loops and blocks of code.
The 'comment' command will add comments for file header, lookup table, defintion and block headers.
The file header contains the file name
//-------------------
// filename.e
//-------------------
The block header contains the block name and a list of the variables.
//-----------------------
// Block: Blockname
//-----------------------
// Variables:
// Variable1
// Variable2
//-----------------------
Headers will only be added if the block or file hasn't already got a header.
All the code examples in this manuals where commented and formated using these commands.
If you have formatted a file and you are are happy with the result then the file it can be saved by typing 'save'.
Trace allows you to see what the code is actually doing the lines of code are displayed as they are executed.
To turn trace on type trace on and the execute a program.
To turn trace off type trace off.
Trace produces a huge amount of data on the screen which can make using your program difficult. If you set a breakpoint then when the break point is hit you can turn trace on or off for the specific section of code you are interested in.
Break points allow you to set a line of code for the interpreter to stop at. You can then look at the state of the current variables using vstack or turn trace on or off.
The number of break points that can be set is unlimited.
To set a break point type for line 122
breakpoint add 122
To delete a break point
breakpoint kill 122
To remove all break points
breakpoint kill all
To continue running the code when it has hit a break point you can use the run command which will cause the program to continue to run or use the step command to single step through the code a line at a time.
To see the current variables on the stack type vstack.
The variable stack command lists all the current variables, their visibility level and value.
For example
Int 0 : j = 3
Int 1 : k = 0
Float 2 : k = 20.3
Int 3 : k = 38
This shows that there are 4 variables currently on the stack, the first column gives the type, the second the visibility then the variable name and the value.
In the above case there is a j at the lowest level this will be in the 'go block', then there must be 3 calls to other blocks each having a variable k with different types and values.
To see the call stack type cstack this displays a list of blocks and the program line number that the current block was called from.
To get help either use '?' which will show you the quick help menu or use 'help' which will take you into the full help system.
The quick help menu gives you access to the following.
? cmd The evolve commands available and their abbreviations.
? op The currently available operands and their abbreviations.
? int The available interpreter commands.
? license The license information for evolve
The full help system is a menu driven help system giving information on all the commands and syntax information.
The error list displays all the current errors which caused the program to stop running or that have been found while preprocessing the file.
If you are in the middle of a debug session and would like to save your settings then you can use the config commands.
config save Saves the current configuration this will save the currently loaded file, trace, auto load and breakpoint settings.
config load Loads the currently saved configuration, the configuration is also loaded automatically when the interpreter is run.
config reset Clears all the settings from the configuration file. It does not affect the current settings that the interpreter is using.
config Displays the current configuration file settings.
While you use the interpretor you might notice that the line cursor changes this gives indication of the state of the currently loaded and configuration program.
-> No file currently loaded.
+> File loaded no errors detected.
!> File loaded errors detected.
*> File loaded and auto load enabled