Once the ZPE program and the script are installed, using ZPE is easy. This tutorial focuses on use of the interpreter mode more than any other mode. For more information on modes, check the official ZPE documentation.
There are two ways of running ZPE. If the configuration is done properly on
a macOS or Linux machine then a
zpe command should be readily
available. As such to start the ZPE Programming Environment program the
following would be used:
zpe # Alternatively, run it using Java java -jar zpe.jar
The output should be something along the lines of:
ZPE Programming Environment (ZPE) Anniversary Edition 18.104.22.168 (May 2020) Current maximum memory allocated to ZPE is 3641MB. ZLC version 1.7.0 (YASS 18X, ZEN 20X), Zenith Parsing Engine version 1.4, copyright (c) Jamie Balfour 2011 - 2020 Information and contributions can be found at: https://www.jamiebalfour.scot/projects/zpe/ **************************************** * ///////// //////// //////// * * // // // // * * // //////// ////// * * // // // * * //////// // //////// * **************************************** You must specify a run command. The following ZPE Argument Commands (ZACs) are currently supported: -a : Analyse code. Checks if the code is well-formed and valid. -b : Byte code view. Prints a byte code tokenisation of the program. -c : Compile mode. Compiles the code to a file for distribution. -d : Debug code. Allows you to debug the code to a certain number of steps. -e : Export code. Exports code to another language. (underwork). -g : GUI mode. This mode features a basic GUI for editing and running code. -h : Shows the available help commands and provides access to them. -i : Interactive mode. Interactive interpreter for commands from the command line. -j : JSON communication mode. Executes a command or script formatted in JSON. -n : Network remote server. Opens a ZPEServer or ZPEClient. -p : Properties mode. Allows viewing and editing of ZPE properties. -q : Quickfire mode. A GUI single line read mode. -r : Runtime mode. Compiles and runs code using the compiler and runtime. -s : String view. Prints a string tokenisation of the program. -t : Tree mode. Prints the code tree of the code from a file. -v : Version number. Prints the current version number to the console. -w : Web parser. Executes a HTML page with ZPE code. -z : Web server. Starts a HTTP ZPEWebServer instance. --configure : Configure mode. Installs ZPE with the default settings. --man : Manual mode. Searches internal documentation for an internal function, much like the Unix man pages. --zule : ZULE download. Downloads a file from the ZPE Uploaded Library Extensions (ZULE) repository. --update : Download the latest version of the ZPE and install it. To run a compiled script, type its file path as the ZAC. There is more at https://www.jamiebalfour.scot/projects/zpe/
It is very important that the maximum amount of memory allocated is at least 64MB but it is recommended at least 256MB is given.
It is also very important for this tutorial that the version of ZPE is running ZLC (the ZPE Language Compiler) 1.6.7 or later.
The YASS 18X part of the information given specifies the version of the YASS syntax it supports. For this tutorial it is recommended YASS 15X or later is supported.
Finally, the ZEN 20X shown is the version of networking tools built into the ZPE package. This is simply the year, so 19X was 2019 and 20X is 2020.
When running ZPE it is given what is referred to as command line arguments. The
first command line argument, e.g.
-c is known
as the ZAC or ZPE Access Command.
This tutorial focuses on running simple samples of code. As a result of this code can simply be interpreted. ZPE includes a very functional interpreter designed for debugging and for running code. There is a small performance gain from compiling code manually and then running it through the runtime environment but for the vast majority of code used in this tutorial it will be negligible.
Assuming a file called test.txt is used for testing the sample in this tutorial, running it would involve:
zpe -r test.txt
If arguments are needed in the
-r mode the
line argument is provided:
zpe -r test.txt -args 5 10
This would assign the arguments 5 and 10 to the program.