-
Notifications
You must be signed in to change notification settings - Fork 0
Using the Algo Interpreter
To boot up a simple interpreter window, you can run Algo with no command line arguments (eg. algo
). You will be greeted with the following screen:
Algo Language Interpreter v0.x.xxxx, build yyyyy.
(c) Larry Tang, 2019-20xx
For information on how to use this interpreter, enter 'algo help'.
Starting interpreter...
>>
After this, you can now type (line by line, one line is interpreted at a time) any correct grammar, and it will be interpreted and output to the console. If you wish to interpret a script, you can instead pass a file as a command line argument, such as algo myAwesomeFile.ag
. The file extension for Algo is .ag
, but it'll recognise any text file.
This time, there will be no header printed like above, and it will simply automatically run. If you want to activate developer tools for Algo, you can use the --dev
flag after your script (algo myAwFi.ag --dev
). This will dump all variable scopes upon crash or program completion, and show the lexed tokens and parsed tree in Lisp form before runtime. There are also other console flags you can set, which are defined below.
Console Arguments | Purpose |
---|---|
algo |
Starts an interactive shell session for Algo. |
algo --nohead |
Starts an interactive shell session without printing the header. |
algo [filename] --dev |
Executes an Algo script, while showing lexed tokens and the action tree. Dumps variables upon finish. |
algo [filename] |
Executes an Algo script. |
Once you've tested and run your script, you may want to compile it for portability, or to hand to others. To do this, you can use the Algo Language Executable Compiler (ALEC).
Algo (c) Larry Tang, 2019.
Commercial use of Algo must include the LICENSE
file in the same directory as the executable.
Standard Library Documentation: