Jamie Balfour BSc

Welcome to my personal website!

Technology enthusiast

I am very interested in technology, particularly relating to computer science. I am most interested in web design and development.

My main hobby is programming. One of my most well known products from this is ZPE. I also am the sole creator of BalfBlog, BalfBar and BalfSlider.

A little bit about me

In 1997, when I was six years of age, I got my very first computer. I was always very interested in the ins and outs of it and dismantled it to see how it worked.

Years later, in 2016 I received my BSc (with honours) in Computer Science, obtaining a First class degree.

I'd like to welcome you to my website and hope you enjoy using it as much as I have enjoyed building it!

Google Plus
Me
Jamie Balfour BSc
Full stack developer

Zenith Parsing Engine

The Zenith Parsing Engine or ZPE is a complete language parser, compiler and interpreter framework for Java. It interprets and compiles ZenLang (a custom language specific for this) into an abstract syntax tree (AST) and into other languages.

You can download the install package with the configuration script for Mac OS X and Linux here. To run this in your terminal type: sudo ./configure.sh (you need to run with elevated permissions to install it and you will need to be in the directory of the unzipped file) to install all the files including the manual page.

Feel free to leave comments in comments section below.

ZPE Banner

The core of the whole system is the Zenith Framework which can be extended further with more functions and functionalities. As well as this, the Zenith Parsing Engine features a range of built-in functions. Zenith Parsing Engine (ZPE) was also known by it's codename Shifting Sands before getting it's final name.

ZPE was pronounced originally as ZeePeeEee but as of late 2015 it was named after our hamster at the time, Henry, as Zippy (I name a lot of projects after my pets). It was designed specifically for my own fun but also for education purposes, with the main aim being to help introduce those who find programming difficult to a much easier language to learn.

This done using a very flexible compiler, one that will work in many ways, leaving not just one possible way to write a piece of code, but multiple. For example, take a for loop:

ZenLang
for($i = 3, $i < 10, 1)
	//Do something
end for
			

This loop can be modified to have an end loop instead of an end for ending:

ZenLang
for($i = 3, $i < 10, 1)
	//Do something
end loop
			

The same for loop can be written using braces rather than end for to terminate the loop and also using the $i++ increment feature rather than specifying just a number to increment by.

ZenLang
for($i = 3, $i < 10, $i++) {
	//Do something
}
			

It can also be written using semi colons to make the syntax of this identical to PHP:

ZenLang
for($i = 3; $i < 10; $i++) {
	//Do something
}
			

Actually, there are plenty more variations of this same loop. But crucially, all of them compile to the same thing underneath. The compiler does all of the work checking this. So feel free to write it as if it were using braces like C or just using keywords like VB.NET because remember, the compiler is efficient as it is and it can deal with having these extra checks.

How the Zenith Engine works with other languages

Zenith is a stand-alone interpreter as well as a middle-man interpreter. Commands that are specified to it are run as small Java based applications.

The following image shows how it works:

Zenith Engine

How ZPE works with other languages and libraries such as BRS

The Zenith Engine's core principle purpose is to develop intermediate code. This code is then transformed to C, Java, C#, VB.NET, Python and more or it is compiled.

Syntax

There are lots of functions:

Returns in Java are the Zenith equivalent: return ( $v )

In Java maths is written like: int v = 1 + 1 and in ZPE as of version 1.3.5.60 it is written as $v = 1 + 1

Expressions can be nested: print ( floor (1.42) + 1)

You can read more about the syntax by clicking on that tab or clicking here.

Purpose

The Zenith Engine and ZenLang were started in January 2015 as a programming project I decided to start for fun (as with all of my software). In March I could see it was really coming along as a programming syntax and thought I might as well continue with it. From there on, what was originally called only by it's codename, Shifting Sands, became something else.

Just as BlackRabbit Script works on .NET, ZPE works on Java. The two are fundamentally and syntactically different, but with time the .NET version will become identical. Both are variations of my own BlackRabbit Script and soon they will be unified in to the one syntax that works with both. ZenLang as it is known was fully based on the same syntax as BlackRabbit Script started on.

As with the .NET version, ZenLang and the Zenith Parsing Engine are designed as a small compact programming language that can be used within other applications as scripting languages, but they also both feature stand-alone functionality as well. The core aim of the language was to improve the readability of code to make it easier to learn, therefore both languages can also be seen as theoretical and educational languages too.

Technical stuff

ZPE is an LL(1) parser that will compile code from ZenLang to byte-code. The parser requires the use of backtracking and does this incredibly well. By doing things this way, it can assess mathematical expressions in one simple function rather than needing other methods.

Code is converted from byte-code to a FAST (Flat AST). The FAST is then run through an optimiser (only if being compiled to a file). The runtime will then run through the FAST and decide what to do based on the byte-code of each AST.

There are very few regular expression evaluations used in the language which is designed to keep the compile time down.

Compiled files will run faster than interpreted files, but interpeting code still runs relatively quickly.

ZenLang formal specification

The following code sample is pseudocode or a formal language specification for the ZenLang language:

ZenLang
<program> ::= <assign>|<function>|<if>|<for>|<for_each>|<until>|<while>|<when>|<lambda_call>|<function_call>|<try>|<pointer>|<update>|<structure>

<var_symb> ::= $
<const_symb> ::= #
<var> ::= <var_symb> <name>
<const> ::= <const_symb> <name>
<update_before> ::= <var_symb> [++|--] <name>
<update_after> ::= <var_symb> <name> [++|--]
<update> ::= <update_before>|<update_after>
<null> ::= null
<bool> ::= regex: true|false
<int> ::= regex: ((-[0-9]+)|[1-9][0-9]*)(E[0-9]+)?
<hex> ::= regex: 0x[0-9A-f]+
<octal> ::= regex: 0[1-7][0-7]*
<real> ::= regex: [0-9]+.[0-9](E[0-9]+)?
<string> ::= regex: ".*"
<name> ::= regex: _?[A-z][A-z0-9_]*
<list> ::= [<params>]
<map> ::= {<params>}
<value> ::= <string>|<int>|<real>|<bool>|<null>|<list>|<map>|<hex>|<octal>

<inner> ::= {[<program>]}
<param_names> ::= <var> [, <param_names>]
<lambda> ::= function (<params_names>)<inner> [end function]
<function> ::= function <name> (<param_names>)<inner> [end function]

<function_call> ::= <name>(<params>)
<lambda_call> ::= <var>|<const>(<params>)

<term> ::= <name>|<var>|<const>|<update>|<value>|<lambda_call>|<function_call>|<pointer>

<math_symbols> ::= + | - | / | * | %
<comparator_symbols> ::= < | > | >= | <= | != | ==
<logical_join_symbols> ::= || | && | OR | AND
<concatenation_symbol> ::= &
<expr> ::= [<term> [<math_symbols>|<comparator_symbols>|<logical_join_symbols>|<concatenation__symbol> <expr>][)]

<params> ::= [<expr>] [,<params>]
<assign> ::= <var>|<const> = <expr>|<lambda>

<if> ::= if (<expr>)[{]<inner> [<else_if>] [}][end if]
<else_if> ::= else if (<expr>)[{] <inner> [}][<else if>] [}][end if]
<for> ::= for (<var> ;|, <expr> ;|, <int>|<expr>)<inner> [end for]
<for_each> ::= for each (<expr> as <var>)<inner> [end for]
<until> ::= loop until (<expr>)[{]<inner> [}][end loop]
<while> ::= while (<expr>)[{]<inner> [}][end_while|end loop]
<when> ::= when (<var>)[{] <is> <otherwise> [}]
<is> ::= is <value> [do][{] <inner> [}]<is>|<otherwise>|end_when|}
<otherwise> ::= otherwise [do][{] <inner> [}]end_when|}
<try> ::= try[{] <inner> [}][catch[{] (<var>) <inner> [}]] [end try]
<pointer> ::= <var>|<const> => <pointer>|<lambda_call>|<assign>|<function_call>|<var>|<const>|<update>
<structure_inner> ::= <var>|<assign>|<function>
<structure> ::= structure <name> [{]<structure_inner>[}] [end structure]
            
Compared with BRS

BlackRabbit Script or BRS is my .NET Windows equivalent version of the same language. It serves the same purpose but on Windows.

A lot more time and effort went into the development of ZPE than BRS because I had a lot more of a plan when I developed it.

In terms of performance, ZPE is considerably better. In both languages I wrote the same for loop that does the same thing (loops 100,000 times):

ZenLang/BRS
for($i = 0, $i < 100000, 1)
	print($i)
end for
										

The newly designed ZPE performs nearly twice as fast as it did at the start of 2015, and considerably better than the .NET version of 2014 and the original version of 2011.

The following graph shows system times in milliseconds to perform a loop that prints each number up to 100, 000 times:

Latest version
Oldest version

Scores are calculated by determining time in milliseconds taken to do the same task with better results being the ones that takes less time as shown above. Note, the right two bars are versions of BRS and the left two bars are versions of ZPE (with the second bar being ZPE 1.1).

Parser and language features

Many features have been suggested by testers and users of the language, although the majority are my own.

The following core language features have been implemented as of now:

  • LL(1) parser
  • Tree generation
  • Compiling and interpreting code
  • Line reading mode to take individual commands
  • Graphical user interface mode
  • Command line arguments
  • On-the-fly interpreting
  • Core functionalties such as print, arithmetic and string manipulation
  • Variable substitution
  • Variable assignment
  • Condition assessment
  • Bracketed logic and math
  • If statements
  • Loops
  • Functions and nested functions, function calling and nested function calls
  • ZenLang core function overwriting - write functions over core functionalities by defining a function or defining a custom function
  • Optional parameters
  • Finite sets/lists and functions
  • Associative arrays/maps
  • Methods that are multi-functional. Mean, mode, max and min are functions that work on lists and numeric parameters
  • Mathematical parser
  • Recursion has been available since version 1.3.5.60
  • 100 or more built in commands
  • Custom functions written in Java
  • Library support
  • Lambda (λ) expressions and anonymous functions
  • Built in sort algorithms
  • Full support for structures
  • A standard library, written itself in ZenLang, open and compiled and designed to showcase the power of the language.

The following core language features are being developed at the moment and will be available soon:

  • Export to Java

The following core language features are being considered and may come soon:

  • Export to C, C++, VB.NET, C# and Python

There is more in the changelog as to what has been added. You can find the changelog here.

I do regret to inform everyone that I no longer have access to the old versions due to them cluttering my system. I decided to stick to the current version of ZPE code and the three build versions back (so if was writing code for 1.5.0.1 I could still access back to 1.4.3) came to an end at the start of 2017.

Presentation

As I often create slideshows of projects, I have created a slideshow on my website about the ZPE. You can view it from here.

What's good about ZPE?

Really? Do I need to explain this to you again? Ok.

It's open for development

The ZPE is an open for development (closed source for the majority) parser that means you can develop your own functions in Java (one of the most popular programming languages in the world) for it as well as help me develop it.

I maintain the core of the engine, but suggestions are always welcome.

Byte-codes are also available so developing applications using them is easy.

It's one language for all

ZPE will soon allow you to write programs in it and then convert them straight to Java, and eventually other languages. This feature will prove incredibly useful.

It's a mathematical parser

ZPE also can act as a mathematical parser. A lot of my time and effort went into my RMM parser. I had for a long time thought of just running something like JavaScript to do this but I eventually got my RMM to do it's job perfectly.

It can be used for those quick mathematical evaluations from the command line using zpe -m '5+5*10'.

Version 1.4.3 replaced the RMM with the LAMP parser - a much better version that processes both logic and mathematical expressions at the same time.

It's also a learning language

ZenLang or ZL is really simple and is designed to read that way too. I promise to listen to feedback and to never put in complicated structures where ever I can avoid doing so.

It's multi platform

Because the underlying Java programming language that powers the parser is Java, it is already platform independent. This means you can run it on a huge number of devices such as Windows PCs, Macs and Linux machines, as well as many others.

Build your own functions for it

Whilst it is possible to write programs with multiple functions, compile them into a library and run them as ZenLang code, it is also possible to write Java based plugins for the language and let them run as libraries. It works really fluidly and well too!

To get started, download the TestPlugin project and compile it to a JAR file. Place this in the plugins/ folder where the ZenithParsingEngine.jar resides (if the folder does not exist, simply create it and call it "plugins").

The system is very similar to my .NET version but as a bit of a newcomer to the Java world at the time (compared with .NET) I did need the help of this tutorial.

Make sure you have the latest ZPE when you compile to ensure full compatibility! This also ensures that the byte-codes are up to date.

It has a remote mode

This remote mode allows you to setup a server machine that can run more complex tasks on a more powerful computer. Take for instance the limited power of the amazing little Raspberry Pi. Run a ZPE Server on a system with a more powerful Core i7 on it and then run a ZPE Client on the Raspberry Pi and pass all the complex calculations to the more powerful system. ZPE will soon also support sending files for processing and returning them when an operation is complete.

Remote mode can also be used for communication. Open two servers and two clients and pass messages to a graphical interface, creating a small internal instant messenger.

Features and language constructs
  1. Features
    1. Built-in function overriding
    2. Optional parameters
    3. LAMP Logic And Mathematics Parser
    4. Custom keywords
  2. Language constructs
    1. Internal documentation
    2. External documentation
    3. Functions
    4. Assignment
    5. Concatenating strings
    6. Incrementing and decrementing
    7. Constants
    8. Lists
    9. Associative arrays
    10. Conditions
    11. Structures
    12. Objects
    13. Try-Catch statements
    14. If statements
    15. When-Is statements
    16. While loops
    17. Do while loops
    18. Loop until
    19. For loops
    20. For Each loops
    21. Lambda expressions
    22. Threaded functions
    23. Includes

Features

The following are features that the ZenLang has by default:

Built-in function overriding

Functionalities provided by the language can be overridden by simply defining a new one.

None of the "core functions", "chainable functions" or "object functions" can be overridden (although many of them have alternatives which can indeed be overriden). No basic language constructs can be overriden either.

Where it can be achieved, it is done by simply declaring the function within the code.

In this example, we are overriding the multiply (removed as of version 1.3.7) function:

ZenLang
function multiply($n, $times)
	//Multiply
	$out = 0
	for($i = 0, $i < $times, 1)
		$out = $out + $n
	end for
	
	return ($out)
end function
			

Optional parameters

Any parameter can be optional, the only thing that must be done after that is to determine whether it has been set or not. The is_set command is very useful for this purpose.

In some senses, optional paramters was a side effect of the main development of ZPE. It is useful and remains as an option in all versions.

ZenLang
function test($arg1, $arg2, $arg3)
	if(is_set($arg3) && is_set($arg3))
		print($arg2)
		print($arg3)
	end if
end function
			

LAMP Logic And Mathematics Parser

As of version 1.3.5.60, the Real Math Mode or RMM engine permits the use of standard mathematical expressions. These replace the add, subtract, multiply, divide and modulo functions.

As of version 1.4.3, the RMM engine is replaced by LAMP (or LAMP Logic And Mathematics Parser). This works in a totally different way to RMM but it gives the same results. It works on logic as well as standard mathematics.

Expressions can be written as standard maths, like that found in other languages such as JavaScript, C or Visual Basic:

ZenLang
$a = 84 + 43 * 2
$b = 91 - 22 % $a
			

This was reviewed in version 1.4.2 along with the logic parser.

Custom keywords

ZenLang is a flexible language that supports custom keywords. For instance:

ZenLang
test x
            

test has been recognised as a keyword by the compiler in the example above. The compiler knows this is a keyword because a plugin exists that specifies this keyword. The plugin has the following Java code:

Java
import jamiebalfour.zpe.core.AST;
import jamiebalfour.zpe.core.ZenithEngine;
public class ZenithCustomModule implements jamiebalfour.zpe.core.ZenithCustomModule {

    @Override
    public String GetName() {
        return "test";
    }
    @Override
    public AST CompileToAST(ZenithEngine z) {
        
        AST node = new AST();
        z.ExternalMethods.EatSymbol();
        node.value = z.ExternalMethods.GetCurrentCompilerWord();
        
        return node;
    }
    @Override
    public void Traverse(ZenithEngine z, AST node) {
        
        System.out.println(node.value);
        
    }
} 

Language constructs

The following are constructs from the language:

Internal documentation

Internal documentation, often called comments, is a way of informing users what a specific piece of code does.

ZenLang
//This is internal documentation
			

As comments can also be multiline, there is an option to insert them in to longer strings of text:

ZenLang
/*This is an internal comment
*This is an internal comment
End internal comments here*/
			

External documentation

As of version 1.4.1

Version 1.4.1 allows direct exporting using the @ directive. This allows you to produce external documentation.

This means when the code is compiled, using the -h doc command on the compiled file and requesting the documentation by name will return the text that was allocated to that documentation:

ZenLang
@doc "MyFunction : This function returns true"
function MyFunction ()
	return true
end function
				

The description must be quoted after the @doc directive. This is available only as of version 1.4.1. Previous versions use a different system.

This kind of documentation can be very useful if you are distributing your compiled code or planning to add it as a library.

Accessing it again is done with the -h ZAC applied on a compiled script.

Command line
zenith -h doc -f file.zex -s $function_name
				

To read about documentation in older versions prior to version 1.4.1, click here.

Functions

ZenLang
function main($args)
	//Do some stuff here
end function
			

Functions became a huge part of ZenLang in version 1.3.4 when they became importable using the import function. This meant that compiled scripts could be imported into the current script.

Since version 1.4.1, functions can be given a scope. A scope can be normal, private or public. The previous example showed a function with the normal scope. This is roughly equivalent to private. Private means that the function may not be accessed in any program other than it's own. Public allows other scripts or programs to access the method.

Because of the powerful way in which ZPE handles this, the import command.

The following sample demonstrates three functions, each with a different scope.

ZenLang
function main($args)
	//This function has the normal scope
end function
private function main($args)
	//This function has the private scope
end function
public function main($args)
	//This function has the public scope
end function
			

Assignment

Variables are declared with a $ sign at the start of them, as with PHP and many other scripting languages.

Variables should not be names of keywords, e.g. $is is not a valid name for a variable.

ZenLang
$a = 43
$b = true
$c = false
$d = "Hello"
$e = $a || $b
$f = $c
			

Version 1.5.0 added support for hexadecimal and octal values straight from the compiler. The compiler works these out and transforms them to their integer equivalents during compile time.

The following sample shows this:

ZenLang
$hex = 0x43
$octal = 033
            

Hexadecimal numbers start with a 0 followed by an x followed by an hexadecimal values.

Octal numbers start with a 0 followed by any octal numbers.

These styles were borrowed from C.

Concatenating strings

Version 1.4.4 introduced concatenation through the & concatenate operator. This allows joining within expressions.

ZenLang
$a = "Hello" & "World"
            

Versions prior to 1.4.4 should use the string_concatenate function.

Incrementing and decrementing

Incrementing and decrementing work differently in ZenLang to many other languages.

ZenLang
//Pre-decrementing
$--a
//Pre-incrementing
$++b
//Post-decrementing
$c--
//Post-incrementing
$d++
			

As of version 1.4.3.40, incrementing and decrementing can be given any value to increment by using the += and -= operators:

ZenLang
//Increment $a by 4
$a += 4
//Decrement $a by 4
$a -= 4
            

Constants

ZPE provides several built in constants that can be accessed using the # symbol followed by it's name such as #name.

ZenLang
//Returns the value of Pi ( π )
$a = #pi
//Returns Planck's Constant
$b = #planck
//Returns the speed of light
$c = #light
//Returns Coulomb's Constant
$d = #coulomb			
//Returns Euler's Constant
$e = #euler				
//Returns the number of available processing units
$f = #AVAILABLE_PROCESSORS
//Returns the full path from where the script was executed
$g = #SCRIPT_PATH
//Returns the name of the script which was executed
$h = #SCRIPT_NAME
//Returns the start time when the script began executing
$i = #START_TIME
//Returns the user's home directory
$i = #home_directory				
//Returns the current working directory of the system
$j = #cwd
			

Constants can be defined too:

ZenLang
//Defines a custom constant
#my_constant = 51.53
            

Lists

ZenLang
$a = [44, 32, 99]
print([4, 9, 3])
			

Associative arrays

Associative arrays are similar to those found in PHP, as well as having similarities to dictionaries. They differ from ordinary lists in that they store a pair of values. It stores a key which is used to access a value. The key is the left of the equals sign.

ZenLang
$a = [44 => 32, 99 => 93]
			

The empty associative array, which can particularly useful when determining the type of a variable, is represented as [=>]:

ZenLang
$a = [44 => 32, 99 => 93]
print(get_type($a) == get_type([=>]))
            

Prior to version 1.5.3, associative arrays were enclosed in braces ({ }) as opposed to the square brackets used now ([ ]). This change made only a small difference to coding and has no effect on the underlying representation of associative arrays.

Conditions

ZenLang
$cond1 = $a || $b && $c
$cond2 = $a OR $b AND $c	
			

As of version 1.4.2H the ternary operator can be used after a condition. This powerful operator is used to specify a return value on both true and false values:

ZenLang
$x = 10 > 20 || 20 > 10 ? "Correct" : "Wrong"	
			

On this occasion, the result of $x will be "Correct".

As well as this, you can call functions or whatever else you'd like to do, but they must be a single clause statement:

ZenLang
if(10 > 20 || 20 < 10 ? print("Yes") : print("No"));	
			

Wrapping a condition in a single line if statement ensures that the code is concise and short. What happens in the above statement is that the evaluation on the first part is done and then the value false comes back. As a result, the ternary statement returns a function. The function print is given the value "No" and it is then called. Since the if statement does not return anything, the return value is not given back to anything.

On a personal note, I would not recommend this method and would stick to full if statements as opposed to this method. It can be used successfully to make a single line greatest common divisor function:

ZenLang
function gcd($a, $b)

    if($b < 1 ? return ($a) : return (gcd($b, $a - ($b * (floor($a / $b))))));

end function
            

Structures

A structure is a data type in which many inner values can be specified. It provides a framework for all variables and functions.

ZenLang
structure person
	$name = null
	$age = 0
	$email = null
	function set($n, $a, $e)
		$name = $n
		$age = $a
		$email = $e
	end function
end structure
			

Instead of the full word structure being used, the keyword struct may be used.

A structure must be declared using the new or copyof keywords.

Variables and internal functions can be accessed using the accessor literal, -> as shown below:

ZenLang
function main($args)
	$s = new person()
	$t = copyof person()
	
	//Run an internal function within a structure
	$t -> set("Jack", 20, "jack@example.com")
	//Obtain and print a variable from a structure
	print($t -> $name)
	//Set a variable in a structure
	$t -> $name = "Joseph"
end function
			

Prior to version 1.5.3, the accessor literal was called the pointer literal and was represented by =>.

Structures may also be constructed with parameters as of version 1.5.2 of ZPE. The important thing is that they have a built in method called _construct:

ZenLang
structure person
    $name = null
    $age = 0
    $email = null
    function _construct($n, $a, $e)
        $name = $n
        $age = $a
        $email = $e
    end function
end structure                
function main($args)
	$p = new person("John", 20, "john@example.com")
end function
			

ZenLang
structure person
    $name = null
    $age = 0
    $email = null
end structure                
function _output()
	return $name & " " & $age
end function
			

Objects

Structures inherit the features of objects. Structures are a less loose version of object in that they pre-define functions and variables within themselves. This allows the application to define it's own loosely attached variables. Objects like this can be powerful containers for multiple variables. Just as before, the accessor (->) symbol allows access to the object's internal features.

ZenLang
$x = new object()
$x -> $y = 10
print($x -> $y)
			

In ZenLang, objects can be seen as structures without rules. It is important to note that if you are chaining these, you must define each inner variable as an object like so:

ZenLang
$x = new object()
$x -> $y = object()
$x -> $y -> $a = 10
$x -> $y -> $b = 15
print($x -> $y -> $a)
			

These inner values can also be assigned with functions, taking advantage of lambda functions makes this easy:

ZenLang
$x = object()
$x -> $y = function() print (true) end function
$x -> $y()
			

It is important to note that functions cannot be directly assigned to objects but must first be abstracted using lambda functions as above.

The object() function is an important part of this.

Objects became available in version 1.4.1 and cannot be used in versions prior to this.

As of version 1.5.2 it is also possible to serialize and deserialize objects and structures using ZPE's serialise (save) and deserialise (open) methods:

ZenLang
$x = new object()
$x -> $y = function() print (true) end function
$x -> $y()
$x.serialise("test.output")
$y = deserialise("test.output")
            

Try-Catch statements

Version 1.4.3.40 introduced Try-Catch statements and made the way that ZPE handles errors much simpler, leading to an open method for throwing all errors. With the introduction of the Try-Catch statement, ZPE 1.4.3.40 opened a whole world of possibilities for throwing errors.

When an error is thrown and a Try-Catch statement surrounds this, the error is handled by the program. The following example shows a list of two elements but the user attempts to access a third, causing an error.

ZenLang
$l = [32, 55]
try
    //Attempt to access third element
    list_get_at_index($l, 2)
end try
            

Since a third element does not exist the program would crash, but since it is wrapped in the Try statement (line 2), the program execution continues. In this next example, the program does not just continue but it takes a different route down the Catch route.

ZenLang
$l = [32, 55]
try
    //Attempt to access third element
    list_get_at_index($l, 2)
catch
    std_err("Attempted to access an invalid index")
end try
            

Since most built-in functions have error messages that they send upward, it is useful to observe these messages. To do this, the Catch statement is given a variable. This variable will be given a value if the error occurs and will be visible only within the Catch statement.

ZenLang
$l = [32, 55]
try
    //Attempt to access third element
    list_get_at_index($l, 2)
catch($exception)
    std_err($exception)
end try
            

In this case, the application is designed to print the error message found in $exception to the standard error output stream.

If $exception was defined before the Catch statement, it will automatically be reset to it's value beforehand.

Finally, as with most statements in ZenLang, Try-Catch statements can use braces like Java and C instead of the end try based structure. The following is the same program with the brace structure:

ZenLang
$l = [32, 55]
try {
    //Attempt to access third element
    list_get_at_index($l, 2)
} catch($exception) {
    std_err($exception)
}
            

If statement

If statements do one thing if the condition is satisified, or do another thing if it is not. They are the most basic form of conditional checking.

ZenLang
if($a < 10)
	//Do something
elseif($b > $a && $b < 15)
	//Do something else if something
else
	//Do something else
end if
//Alternatively, as of version 1.3.4.90, if statements can be a single line, terminated with a semi-colon
if($m == 10) print("It does indeed");
			

When-Is statement

When-Is statements are similar to the switch/case statements found in other languages like Java or Visual Basic. The do keyword is entirely optional as well.

ZenLang
when($a)
	is 0 do
		//Do something when $a = 0
	is 1 do
		//Do something when $a = 1
	is 2 do
		//Do something when $a = 2
	otherwise do
		//Do something when $a is something else
end when
			

While loops

A while loop will loop while a condition is true.

ZenLang
while($a < 10)
	//Do something
end while
			

A common form of while loop is the while-true loop. This loop will continue indefinitely since there is no condition from which it will stop. It can be broken by a return or break command, however.

ZenLang
while(true)
    //Do something
end while
            

As with all loops, while loops may be terminated by end loop.

ZenLang
while($a < 10)
	//Do something
end loop
			

Do while loops

Version 1.5.1 added do while loops. These loops are incredibly simple to use and work exactly as a standard while loop does except with one subtle difference. A while loop may not necessarily execute a statement:

ZenLang
$a = 0
while($a > 10)
	//Do something
end loop
			

With a do while loop it is guaranteed to execute at least once. Many other languages out there also implement a do while loop that works similarly. Below is an example of a do while loop in ZenLang:

ZenLang
$a = 0
do
	//Do something
loop while($a > 10)
			

Loop until

ZenLang
loop until($a > 10)
	//Do something
end loop
			

For loop

This for loop will assign $i with three and increment it by 1.

ZenLang
for($i = 3, $i < 10, 1)
	//Do something
end for
			

This for loop will assign $i to $j and increment $i by 2.

ZenLang
$j = 4
for($i = $j, $i < 10, 2)
	//Do something
end for
			

This for loop will not instantiate $i but will inform the loop that $i is the value to increment.

ZenLang
$i = 3
for($i, $i < 10, 1)
	//Do something
end for
			

As of version 1.4.2, for loops can be written in the exact syntax of a C-style for loop in that the $i++ can be used in place of the increment or decrement value. Placing a pre-decrement or pre-increment expression such as $--i will result in the value being changed before the for loop iterates.

ZenLang
for($i = 3, $i < 10, $i++)
	//Do something
end for
			

As with all loops, for loops may be terminated by end loop.

ZenLang
for($i = 3, $i < 10, 1)
	//Do something
end loop
			

For Each loop

A for each loop differs from a standard loop in that it requires some iterable expression and a variable assignment which will permit it to iterate the expression. For each loops were available from version 1.3.5 onwards.

ZenLang has just one iterable expression that appears several times throughout the language - the list.

The iterable expression can also be a variable containing a list.

ZenLang
for each([43, 99, 32, 84] as $value)
	print($value)
end for
			

Or using a variable instead of a list:

ZenLang
$values = [43, 99, 32, 84]
for each($values as $value)
	print($value)
end for
			

Lambda expressions

As of version 1.3.7.44 lambda (λ) expressions are now supported in ZPE. These are known as anonymous functions and they are designed to make the language more flexible and simpler. They are, without any doubt, my favourite feature of the language and you will see that a lot of my functions benefit from the use of lambda functions.

A lambda function or lambda abstraction is a function that is not bound to any identifier, that is, the function is never defined as a function but it can be assigned to a variable and so on. Although 1.3.7.44 added these lambda expressions, more support will be added as time goes on.

The syntax is shown below:

ZenLang
$foo = function($x, $y, $z){return $x + $y + $z}
$bar = function($x, $y, $z) return $x + $y + $z end function
print($foo(3, 4, 6))
print($bar(3, 4, 6))
			

The language provides two ways of defining these functions, one is the C-like way of using curly braces ({}) around the function and the second is to use the end function keywords to terminate the function.

Functions need not have a return value, that is, no return function is required in order for this to work:

ZenLang
$foo = function($x){print ($x + 5)}
$foo(3)
			

Lambda expressions also can be given values straight from the declaration, which can make them more useful in other functions:

ZenLang
print(function($x){return ($x + 5)}(5))
			

The result of this evaluation is 10, so the print function will simply print 10. Variables, functions and so on can all be used as well.

Lambda functions are also very useful with the special csv_to_list function, which takes a function as it's optional second parameter. Rather than defining some function that may only be used once, it may make more sense to define a lambda function:

ZenLang
$content = "32, 41, 91, 36"
$out = csv_to_list($content, function($x){return $x + 5})					
//Should print 37, 46, 96, 41
print($out)
$out = csv_to_list($content, function($x, $rowpos, $columnpos){
	return $x + 5 + $columnpos
})					
//Should print 37, 47, 98, 44 because the column position is added to the value
print($out)
			

Also note, that unlike Python, lambda functions can be defined across many lines, not just one.

It is important to note that ordering of lambda variables is important. For a function like csv_to_list the order is crucial but it can be any number of parameters so for instance $columnpos need not be specified.

Threaded functions

Version 1.5.1 adds threaded functions. These functions are very similar to lambda functions except that whenever they are called they will run in a different thread.

ZenLang
threaded $foo = function($x){print ($x + 5)}
$foo(3)
            

Threaded functions will operate in a different thread. This is useful particularly for server operations added in version 1.5.0.

Includes

One of the greatest things about C or PHP is being able to include files. ZPE has supported libraries since a version of version 1.3 and yet it has no way to include a script, other than the run_script method.

To make development of larger applications more efficient ZPE 1.5.1 features a new includes keyword. This keyword signifies to the compiler to include a file's contents. The file should be UTF-8 text but the extension does not matter.

It's really easy to use the new feature by simply using:

ZenLang
includes "file_to_include.txt"
            
Core functions
  1. Core Zenith Engine commands
    1. Core functions
      1. is_set
      2. unset
      3. global
      4. invert_value
      5. import
      6. run_script
      7. run_command
      8. exit
      9. sprintf
      10. shell
      11. shutdown
      12. get_zpe_property
      13. get_max_memory
      14. get_os_name
      15. get_type
      16. std_new_line
      17. throw_error
      18. std_err
      19. std_out
      20. std_in
      21. handle_of
      22. permission_level_of
      23. list_local_variables
      24. list_parameters
      25. list_global_variables
      26. supports
      27. feedback
      28. get_nanoseconds
    2. Chainable functions
      1. length
      2. get
      3. put
      4. remove
      5. remove_at
      6. to_string
    3. Object functions
      1. get_object_definition
      2. serialise
      3. deserialise
    4. Input functions
      1. get_yes_no
    5. Mathematical functions
      1. power
      2. square
      3. cube
      4. sine
      5. cosine
      6. tangent
      7. absolute_value
      8. square_root
      9. cube_root
      10. factorial
      11. floor
      12. ceiling
      13. round
      14. significant_figures
      15. limit_real
      16. random_number
      17. value
      18. remove_exponent
      19. range
      20. counter
      21. to_binary
      22. to_octal
      23. to_hexadecimal
      24. greater_than_all
      25. greater_than_any
      26. less_than_all
      27. less_than_any
      28. equals_any
      29. all_true
      30. all_false
      31. any_true
      32. any_false
      33. xor
    6. Message digest functions
      1. sha1
      2. sha256
      3. md5
    7. String functions
      1. integer_to_character
      2. character_to_integer
      3. string_get_character_at
      4. string_get_length
      5. string_contains
      6. string_split
      7. string_splice
      8. string_divide
      9. string_find_occurences
      10. string_get_substring
      11. string_to_lowercase
      12. string_to_uppercase
      13. string_replace
      14. string_starts_with
      15. string_ends_with
      16. string_cut
      17. string_trim
      18. string_trim_start
      19. string_trim_end
      20. string_matches
      21. string_to_date
      22. string_is_numeric
      23. string_is_lowercase
      24. string_is_uppercase
    8. File functions
      1. is_directory
      2. directory_exists
      3. directory_list_files
      4. directory_create
      5. is_file
      6. file_exists
      7. file_get_size
      8. file_get_name
      9. file_open
      10. file_write
      11. file_copy
      12. file_delete
    9. List functions
      1. list_add_element
      2. list_remove_element
      3. list_get_at_index
      4. list_get_at_random_index
      5. list_pop
      6. list_dequeue
      7. list_get_length
      8. list_contains
      9. list_get_index_of
      10. list_insert_at_index
      11. list_set_at_index
      12. list_reverse
      13. list_sort
      14. list_swap_elements
      15. list_join
      16. list_is_a_set
    10. Set functions
      1. set_from_list
      2. set_intersection
      3. set_union
      4. set_difference
      5. set_cartesian_product
    11. Associative array functions
      1. associative_array_get
      2. associative_array_put
      3. associative_array_contains
      4. associative_array_get_keys
      5. associative_array_flip
    12. List & mathematical functions
      1. get_minimum
      2. get_maximum
      3. get_range
      4. get_mean
      5. get_mode
      6. get_median
    13. Image functions
      1. image
      2. file_open_image
      3. file_save_image
      4. image_transform_greyscale
      5. image_transform_sepia
      6. image_transform_invert_colour
      7. image_transform_resize
      8. image_transform_rotate
      9. image_get_width
      10. image_get_height
      11. image_get_pixel
      12. image_set_pixel
      13. screen_grab
    14. Date & time functions
      1. compare_dates
      2. difference_between_dates
      3. get_time
    15. Specialised functions
      1. csv_to_list
      2. json_to_map
      3. generate_alphabet
    16. MySQL functions
      1. mysql_connect
    17. Deprecated and removed functions
      1. return
      2. break
      3. object
      4. open_remote_client
      5. open_remote_server
      6. string_concatenate
      7. add
      8. subtract
      9. multiply
      10. divide
      11. modulo
      12. increment
      13. decrement

Core Zenith Engine commands

The following is a concise list of all built-in functions, their parameters, their return types and their purpose.

Please know that deprecation means that a function or structure has a planned removal date but still exists for backward compatibility sake. The function or structure becomes deprecated when the replacement feature is added and is scheduled for removal a few versions later from deprecation.

There are several things to note about these functions and how they appear on this website.

Firstly, the [ ] around some parameters refers to a parameter that is optional, i.e. a parameter that does not need to be defined to satisfy the call request on the function.

Secondly, if a function can take a parameter message1, as well as being able to take message2, message3 and messageN, then the function can take infinitely many parameters.

Finally, most of the functions have alternative names. This is simply an alias to the function and if necessary can be completely overridden using the built-in function overriding.

There are currently 0 built-in functions (also known as commands) available0.

When a parameter or return type is mixed, it implies that it has multiple types and can be either overloaded or the program should expect any of a bunch of return types from this function. This should be handled by the programmer when assessing the value using the get_type function.

Core functions

None of the core functions can be overwriten by any other function.

is_set (var variable) ⇒ boolean
Determines if a variable has already been defined locally, globally or as a parameter. This is particularly useful for determining if an optional parameter has been defined.
First available: Version 1.3.1
unset (var variable) ⇒ boolean
Destroys any references to a variable. It follows the standard variable hierarchy in that it will find a local variable, then a parameter then a global variable which if not found will result in the function returning false.
First available: Version 1.3.5.190
global (var variable) ⇒ boolean
Promotes a local variable or parameter to a global variable. It keeps a copy of the local version as well as the global, but produces a global copy. If the variable is not defined, that is, the variable cannot be found in the global variables, parameters or local variables for the current function, the function returns false otherwise it returns true.
First available: Version 1.3.7.95
invert_value (object value) ⇒ mixed
Takes in a value and inverts it. For a boolean variable it inverts it so that true becomes false and false becomes true. This can be applied to any expression in a boolean expression, including a function that returns one. If given a number, it will make a negative number a positive number and a postive number a negative number.
Alternative function names: not
First available: Version 1.3.4.90
import (string file[, boolean overwrite]) ⇒ void
Imports all functions except the main function found in compiled script (compiled using the -c ZAC). If the overwrite variable is given the value true, it will overwrite internally defined functions.
First available: Version 1.3.4
run_script (string file) ⇒ mixed
Runs a script inside a new Zenith Parsing Engine. Scripts cannot directly interact as part of the sandbox feature, unless they are specifically instructed to via some kind of file system. If the script returns a value, this function will take that value as it's own return value.
First available: Version 1.3.5
run_command (string command) ⇒ mixed
Runs a single command from a string such as a mathematical expression and returns the return value from it. This allows on-the-fly interpreting. It can be used to return the value of a mathematical term such as: run_command("5 + 5").
First available: Version 1.3.5.62
exit ([string message]) ⇒ void
Optionally prints a message and then exits the program.
Alternative function names: bye_bye
First available: Version 1.3.1
sprintf (string command) ⇒ mixed
Performs a replacement of each %s 'sprint' within a string, str.
First available: Version 1.5.4
shell (string command) ⇒ mixed
Runs a shell command, for example a Bash command. It then returns a string with the return value of the command.
First available: Version 1.3.1
Version 1.4 dropped support for unix_runtime aliase for this command.
shutdown (string command) ⇒ void
Runs a the shutdown command, given a parameter, command, which specifies the shutdown request (e.g. -r for restart).
First available: Version 1.3.2
get_zpe_property (string property) ⇒ mixed
Returns the value of a ZPE property used by the ZPE core. If the key does not exist, it returns false and displays an error message explaining that the key was not found.
First available: Version 1.5.1
get_max_memory () ⇒ integer
Returns the maxmium allocated memory given to the JVM and in turn this application.
First available: Version 1.3.5.90
get_os_name () ⇒ string
Returns the operating system name.
First available: Version 1.3.2
get_type (mixed o) ⇒ string
Returns the type of a variable stored in the memory or the type of an object. It's important to note that comparing types of values should not be done by comparing the result of the get_type command against a string value but it should be compared against another get_type function. E.g. the following is not recommended: get_type([32, 44]) == "list" but get_type([32, 44]) == get_type([]) is.
First available: Version 1.3.3
std_new_line () ⇒ string
Gets the environment new line character. For instance, on Mac OS X this is the \n character.
First available: Version 1.5.2
Gets the environment new line character. For instance, on Mac OS X this is the \n character.
Alternative function names: new_line
First available: Version 1.4.0.23
throw_error (string message) ⇒ void
Throws an error with the message given in msg. If the error is not caught, ZPE will exit the program.
First available: Version 1.4.3.40
std_err (object message1[, object message2, object message3, ..., object messageN]) ⇒ string
Prints an error message to the standard error of the system and returns the message. It also has infinite arguments which will be joined before printing.
Alternative function names: print_error
First available: Version 1.3.4
std_out (object message1[, object message2, object message3, ..., object messageN]) ⇒ string
Prints a message to the standard output of the system and returns the message. It also has infinite arguments which will be joined before printing.
Alternative function names: print
First available: Version 1.3.1
std_in (string message) ⇒ string
Gets a user input from the command line or dialog in GUI mode.
Alternative function names: get_input
First available: Version 1.3.1
handle_of (string function_name) ⇒ function
Gets a function from it's name, function_name and returns it. This gives the actual function, not a reference to it and therefore certain other functions will be able to take the function in.
Alternative function names: handle
First available: Version 1.3.7.0
permission_level_of (string function_name) ⇒ integer
Gets the permission level of a function given as a function handle.
First available: Version 1.4.0.23
list_local_variables () ⇒ list
Returns a list that contains the identifiers of all local variables.
First available: Version 1.3.7.44
list_parameters () ⇒ list
Returns a list that contains the identifiers of all parameters in the current function.
First available: Version 1.3.7.44
list_global_variables () ⇒ list
Returns a list that contains the identifiers of all global variables.
First available: Version 1.3.7.44
supports (string function_name) ⇒ boolean
Returns whether or not a specified function is within the function list and supported by the current version of ZPE. This can be used to determine if a built in function is supported, for instance if a future version is added later. It is similar to Apache <IfModule>
First available: Version 1.4.4.0
feedback (string message) ⇒ boolean
Sends feedback directly to Jamie Balfour using his website.
First available: Version 1.5.0
get_nanoseconds () ⇒ integer
Returns the current number of nanoseconds.
First available: Version 1.5.1
wait (integer milliseconds) ⇒ void
Waits for a number of milliseconds specified before continuing execution.
First available: Version 1.5.3

Chainable functions

All of these functions can be chained to an item:

ZenLang
$v = "Hello world"
print(length($v))
length (object item) ⇒ integer
Returns the length of a countable element.
First available: Version 1.4.3
get (object index) ⇒ mixed
Returns the element at the position in the string or list or the item from the key in an associative array.
First available: Version 1.4.3
put (object item, object toAppend) ⇒ mixed
Appends an Object to the end of a list or to the end of a string or puts a key and element mapping into an associative array.
First available: Version 1.4.3
remove (object item) ⇒ mixed
Removes an Object from a list, or removes a key to value pair in an associative array.
First available: Version 1.4.3
remove_at (integer index) ⇒ mixed
Removes an item at an integer from a list.
First available: Version 1.4.3
to_string (object item) ⇒ string
Converts any value to a string.
First available: Version 1.4.3

Object functions

These functions relate to ZenObjects. ZenObjects are the super class of structures, that is, all structures inherit the features of objects in ZenLang.

Some of the functions here, such as the serialise method, are also chainable. This means that they can be attached to an object as shown below:

ZenLang
$v = new object()
$v.serialise("test.zo")
get_object_definition (object item) ⇒ string
Returns the structure definition that this object inherits it's format from. This function is also chainable to an object.
First available: Version 1.5.3
serialise (object item, string file) ⇒ boolean
Serialises an object or structure to a file. This function is also chainable to an object.
Alternative function names: serialize, save_object_to_file
First available: Version 1.5.2
deserialise (string file) ⇒ object
Deserialises an object or structure from a file.
Alternative function names: deserialize, open_object_from_file
First available: Version 1.5.2

Input functions

get_yes_no (string message[, string title]) ⇒ string
Gets a boolean Yes or No from the user.
First available: Version 1.3.2

Mathematical functions

power (real value, real exponent) ⇒ real
Gets a power of a number as a real.
First available: Version 1.3.1
square (real value) ⇒ real
Gets a power of a number as a real.
Alternative function names: power
First available: Version 1.3.1
cube (real value) ⇒ real
Gets a power of a number as a real.
Alternative function names: power
First available: Version 1.3.1
sine (real value) ⇒ real
Takes a value as a real and calculates it's sine value as a real.
Alternative function names: sin
First available: Version 1.3.1
cosine (real value) ⇒ real
Takes a value as a real and calculates it's cosine value as a real.
Alternative function names: cos
First available: Version 1.3.1
tangent (real value) ⇒ real
Takes a value as a real and calculates it's tangent value as a real.
Alternative function names: tan
First available: Version 1.3.1
absolute_value (real value) ⇒ real
Calculates the absolute value of a number. E.g. absolute_value(-5) = 5.
Alternative function names: abs
First available: Version 1.3.1
square_root (real value) ⇒ real
Takes a value as a real and calculates the square root of that value.
Alternative function names: sqrt
First available: Version 1.3.1
cube_root (real value) ⇒ real
Takes a value as a real and calculates the cube root of that value.
Alternative function names: cbrt
First available: Version 1.3.7.0
factorial (integer value) ⇒ integer
Takes a value as an integer and returns it's factorial, that is n!. If n is ≥ 40 it will return -1 as it would result in an arithmetic overflow.
Alternative function names: fact
First available: Version 1.3.1
floor (real value) ⇒ integer
Rounds a number down.
Alternative function names: pessimistic
First available: Version 1.3.1
ceiling (real value) ⇒ integer
Rounds a number up.
Alternative function names: ceil or optimistic
First available: Version 1.3.1
round (real value) ⇒ integer
Rounds a number up or down to the closest full number.
First available: Version 1.3.1
significant_figures (real value, integer number_of_sig_figs) ⇒ real
Rounds a number, value, to a specified number of significant figures, number_of_sig_figs.
First available: Version 1.3.7.25
limit_real (real value, real min, real max) ⇒ real
Forces a number to be within the range of the min and max value. If the number is within the range, it will return the number, otherwise if it is less than min it will return min or if it is greater than the max value it will return max.
First available: Version 1.3.5.32
random_number (real max, real min) ⇒ real
Generates a random number.
First available: Version 1.3.1
value (string value) ⇒ real
Parses an string which holds an integer or real to a real.
First available: Version 1.3.1
remove_exponent (real value) ⇒ string
Removes the exponent and transforms the number to a non-floating point number string.
First available: Version 1.3.5.90
range (integer max[, integer min]) ⇒ list
Generates a list of integers ranging from the minimum to the maximum.
First available: Version 1.4.1.0
counter (list items[, function f]) ⇒ associative_array
Generates an associative array of the count of all instances of a string. If a function is supplied to this, each item will be passed to the function first. For example:
ZenLang
function main($args)
    $list = [["Ashley", 32], ["Jonathan", 64], ["Adam", 12], ["Jamie", 32], ["Frank", 64]]
    //By passing this to the function, we can return the second index (index 1) from the inner list and count that
    $counted = counter($list, function($x){return list_get_at_index ($x, 1)})
    //Should return {12 => 1, 64 => 2, 32 => 2}
    print($counted)
end function
                        

Using a function is useful when you are working with an array of arrays, since the function compares based on the object as a whole. Given some lambda function, only a part of the inner arrays could be returned and processed.

First available: Version 1.4.1.0
to_binary (real value) ⇒ string
Transforms a real into a binary string
First available: Version 1.3.4.90
to_octal (real value) ⇒ string
Transforms a real into an octal string
First available: Version 1.3.4.90
to_hexadecimal (real value) ⇒ string
Transforms a real into a hexadecimal string
First available: Version 1.3.4.90
greater_than_all (real val1, real val2, real val3, ..., real valN) ⇒ boolean
Compares the first value as a real to a collection of reals and returns a boolean stating whether the first value is greater than all other values.
First available: Version 1.3.1
greater_than_any (real val1, real val2, real val3, ..., real valN) ⇒ boolean
Compares the first value as a real to a collection of reals and returns a boolean stating whether any value is greater than the first value.
First available: Version 1.4.4
less_than_all (real val1, real val2, real val3, ..., real valN) ⇒ boolean
Compares the first value as a real to a collection of reals and returns a boolean stating whether the first value is less than all other values.
First available: Version 1.3.3.1
less_than_any (real val1, real val2, real val3, ..., real valN) ⇒ boolean
Compares the first value as a real to a collection of reals and returns a boolean stating whether any value is less than the first value.
First available: Version 1.4.4
equals_any (real val1, real val2, real val3, ..., real valN) ⇒ boolean
Compares the first value as a real to a collection of reals and returns a boolean stating whether first value equals any other value.
First available: Version 1.3.4
all_true (boolean val1, boolean val2, boolean val3, ..., boolean valN) ⇒ boolean
Assesses a list of parameters to see if all values equate to true. It is the equivalent to building a comparison with many ANDs.
First available: Version 1.3.7.89
all_false (boolean val1, boolean val2, boolean val3, ..., boolean valN) ⇒ boolean
Assesses a list of parameters to see if all values equate to false. It is the equivalent to building a comparison with many ANDs and inverting each value.
First available: Version 1.3.7.89
any_true (boolean val1, boolean val2, boolean val3, ..., boolean valN) ⇒ boolean
Assesses a list of parameters to see if any of the values equate to true. It is the equivalent to building a comparison with many ORs.
First available: Version 1.3.7.89
any_false (boolean val1, boolean val2, boolean val3, ..., boolean valN) ⇒ boolean
Assesses a list of parameters to see if any of the values equate to false. It is the equivalent to building a comparison with many ORs and inverting each value.
First available: Version 1.3.7.89
xor (boolean a, boolean b) ⇒ boolean
Returns the exclusive-or (XOR) on two boolean values. i.e. !($a && $b) && ($a || $b).
First available: Version 1.4.3

Message digest functions

sha1 (string message) ⇒ string
Returns a SHA1 version of some message given to the function.
First available: Version 1.4.3.40
sha256 (string message) ⇒ string
Returns a SHA256 version of some message given to the function.
First available: Version 1.4.3.40
md5 (string message) ⇒ string
Returns a MD5 version of some message given to the function.
First available: Version 1.4.3.40

String functions

integer_to_character (integer i) ⇒ character
Converts a single integer, i, to an character.
Alternative function names: int_to_char
First available: Version 1.3.3
character_to_integer (character c) ⇒ integer
Converts a single character, c, to an integer.
Alternative function names: char_to_int
First available: Version 1.3.3
string_get_character_at (string text, integer index) ⇒ character
Gets a character from a string text at the index specified.
Alternative function names: get_char_at|char_at
First available: Version 1.3.1
string_get_length (string text) ⇒ integer
Gets the length of any fixed length string.
Alternative function names: str_len
First available: Version 1.3.1
string_contains (string text, string word1[, string word2, string word3, ..., string wordN]) ⇒ boolean
Checks if a string contains an infinite number of other strings or characters.
Alternative function names: str_contains
First available: Version 1.3.2
string_split (string text[, string delimiter]) ⇒ list
Splits a string using a delimiter. The default delimiter is the space symbol.
Alternative function names: str_split
First available: Version 1.3.3
string_splice (string text, list split_points) ⇒ list
Splits a string at certain points specified in a list. The function then returns a list of strings.
Alternative function names: str_divide
First available: Version 1.5.0.1
string_divide (string text, integer length) ⇒ list
Splits a string at after a certain number of characters and puts the split strings into a list. The remaining characters will be put into the list also.
Alternative function names: str_divide
First available: Version 1.5.0.1
string_find_occurences (string haystack, string needle) ⇒ list
Returns a list of integers which represent the position at which each needle appears within the haystack string.
Alternative function names: str_find
First available: Version 1.3.3

Version 1.5.0.1 dropped the alternative name str_find_occ and added the str_find alernative name.

string_get_substring (string text, integer start, integer end) ⇒ string
Returns a substring that is a portion of the main string, text, that begins at the index start and finishes at the index end.
Alternative function names: str_substring
First available: Version 1.3.3
string_to_lowercase (string text) ⇒ string
Converts a string to a lowercase version of it.
Alternative function names: str_lcase
First available: Version 1.3.3
string_to_uppercase (string text) ⇒ string
Converts a string to a uppercase version of it.
Alternative function names: str_ucase
First available: Version 1.3.3
string_replace (string text, string search, string replace) ⇒ string
Performs a regular expression match for search, and replaces it with a string, replace, in text.
Alternative function names: str_replace
First available: Version 1.3.3
string_starts_with (string text, string search) ⇒ boolean
Returns a boolean true or false value as to whether a string, text, starts with the regular expression, search.
Alternative function names: str_starts_with
First available: Version 1.3.3
string_ends_with (string text, string search) ⇒ boolean
Returns a boolean true or false value as to whether a string, text, ends with the regular expression, search.
Alternative function names: str_ends_with
First available: Version 1.3.3
string_cut (string text, integer start_cut[, integer end_cut]) ⇒ boolean
Cuts a certain number of characters from a string. If only start_cut is provided, it will cut the same number from the start and end.
Alternative function names: str_cut
First available: Version 1.5.0.
string_trim (string text[, string search]) ⇒ string
Trims a string at the start and the end, removing all instances of a character. If no search parameter is given, the function simply takes the space character and trims the string of it.
Alternative function names: str_trim
First available: Version 1.3.5.90
string_trim_start (string text[, string search]) ⇒ string
Trims a string at the start, removing all instances of a character. If no search parameter is given, the function simply takes the space character and trims the string of it.
Alternative function names: str_trim_start
First available: Version 1.3.5.90
string_trim_end (string text[, string search]) ⇒ string
Trims a string at the end, removing all instances of a character. If no search parameter is given, the function simply takes the space character and trims the string of it.
Alternative function names: str_trim_end
First available: Version 1.3.5.90
string_matches (string text, string regex_pattern) ⇒ boolean
Returns a boolean true or false value as to whether a string, text, matches the regular language pattern, regex_pattern.
Alternative function names: str_matches
First available: Version 1.3.3
string_to_date (string date, string format) ⇒ date
Transforms a string which is the of the format, format, to a date. E.g. string_to_date("25-10-2015 14:00:24", "dd-MM-yyyy hh:mm:ss")
Alternative function names: str_to_date
First available: Version 1.3.4
string_is_numeric (string text) ⇒ boolean
Determines if a string is of the number format.
Alternative function names: str_is_numeric|is_numeric
First available: Version 1.3.2
string_is_lowercase (string text) ⇒ boolean
Returns true if the string or character specified is a lowercase string or character.
Alternative function names: str_is_lcase
First available: Version 1.3.7.1
string_is_uppercase (string text) ⇒ boolean
Returns true if the string or character specified is an uppercase string or character.
Alternative function names: str_is_ucase
First available: Version 1.3.7.1

File functions

is_directory (string file) ⇒ boolean
Determines if a the object at the end of the path is a directory. If the directory does not exist it returns 0.
First available: Version 1.3.2
directory_exists (string file) ⇒ boolean
Determines if a directory exists within the local file system.
Alternative function names: direxists
First available: Version 1.3.2
directory_list_files (string path) ⇒ list
Returns a list of files that exist in a specified path.
Alternative function names: dir_list
First available: Version 1.3.5.32
directory_create (string path) ⇒ boolean
Creates an empty directory at the location specified and returns the boolean true on success.

In versions prior to version 1.4.1, this was the file_create_directory function.

First available: Version 1.4.23
is_file (string file) ⇒ mixed
Determines if a the object at the end of the path is a file. If the file does not exist it returns 0.
First available: Version 1.3.2
file_exists (string file) ⇒ boolean
Determines if a file exists within the local file system.
Alternative function names: fexists
First available: Version 1.3.2
file_get_size (string file) ⇒ integer
Returns the size of a file, in bytes. If the file is not found it returns -1.
Alternative function names: fsize
First available: Version 1.3.5
file_get_name (string file) ⇒ string
Returns the name of a file. This return the actual name of the file, minus directories, so it is essentially the last part of the path. E.g. /User/Documents/f.txt would return f.txt
Alternative function names: fname
First available: Version 1.4.0.23
file_open (string file[, string format[, boolean escape_string]]) ⇒ string
Reads all bytes within a file and either returns it as a list of bytes or a string. Version 1.5.3 added the format and escape_string parametersf.
Alternative function names: fopen
First available: Version 1.3.2
file_write (string file_name[, boolean append], string contents1[, string contents2, string contents3, ..., string contentsN]) ⇒ string
Writes an infinite amount of parameters to a text file. You can append text on the end by inserting the boolean append before writing the file. Note, if you do choose to do this and wish to write a boolean true or false value to the file, the suggestion is that you should use file_write("filename.txt", "", true) as the second parameter will not be recognised as append boolean.
Alternative function names: fwrite
First available: Version 1.3.2
file_copy (string source, string destination) ⇒ boolean
Copies a file, source, to another location on the file system, destination. Returns a boolean based on whether the file was copied successfully or not.
Alternative function names: fcopy
First available: Version 1.4.1
file_delete (string source) ⇒ boolean
Deletes a file, source, then returns a boolean based on whether the file was copied successfully or not.
Alternative function names: fdelete
First available: Version 1.4.2

List functions

list_add_element (list l, object o) ⇒ list
Adds an element to a list, l. Note: This function does not copy the list, l, but simply adds to it.
Alternative function names: list_add
First available: Version 1.3.1
list_remove_element (list l, integer position) ⇒ list
Removes an element from a list, l, at a specified index position. Note: This function does not copy the list, l, but simply remove from it.
Alternative function names: list_remove
First available: Version 1.3.1
list_get_at_index (list l, integer position) ⇒ mixed
Gets an element from a list, l, at a specified index position.
Alternative function names: list_get_at
First available: Version 1.3.2
list_get_at_random_index (list l) ⇒ mixed
Gets an element from a list, l, at a random index position.
First available: Version 1.4.4
list_pop (list l) ⇒ list
Gets and removes the first element from the list and returns a list containing the new list and the returned value.
First available: Version 1.4.2
list_dequeue (list l) ⇒ list
Gets and removes the last element from the list and returns a list containing the new list and the returned value.
Alternative function names: list_deque
First available: Version 1.4.2
list_get_length (list l) ⇒ integer
Gets the length of a list, l.
First available: Version 1.3.2
list_contains (list l, object element) ⇒ boolean
Checks whether a list, l, contains an element, element.
First available: Version 1.3.2
list_get_index_of (list l, object element) ⇒ integer
From the list, l, obtains the index of an element, element.
Alternative function names: list_index_of
First available: Version 1.3.3
list_insert_at_index (list l, integer pos, object element) ⇒ list
Adds an element, element, to the list, l, at a position, pos. Note: This function does not copy the list, l, but simply adds to it.
Alternative function names: list_insert_at
First available: Version 1.3.3
list_set_at_index (list l, integer pos, object value) ⇒ list
Updates an existing element at the index of the array with a new value, value, to the list, l, at an index, pos.
Alternative function names: list_set_at
First available: Version 1.3.4.90
list_reverse (list l) ⇒ list
Copies the list, l, returns the reversed list of it.
First available: Version 1.3.3
list_sort (list l[, boolean numeric]) ⇒ list
Sorts a list by order, if the optional parameter, numeric, is set to true, the system treats the list as a list of numbers and sorts them on this assumption. Strings are ordered by their ASCII prime number, that is, each character is transformed to a number, and given a prime number power that is equivelant to it's position in the string. It is then multiplied by the next giving a unique number. Then it is transformed to a string again. Note: This function does not copy the list, l, but simply sorts the original list.
First available: Version 1.3.4
list_swap_elements (list l, integer p1, integer p2) ⇒ list
Swaps two elements within the list, l at positions p1 and p2 within the list. Note: This function does not copy the list, l, but simply swaps the elements in the original list.
First available: Version 1.3.3
list_join (list l1, list l2) ⇒ list
Joins two lists, l1 and l2, and returns the joint lists.
First available: Version 1.3.3
list_is_a_set (list l) ⇒ boolean
Returns true if a list, l, is a set, that is, a list without duplication.
First available: Version 1.3.7.1

Set functions

set_from_list (list l) ⇒ list
Converts a list, l, to a set without duplication.
First available: Version 1.3.2
set_intersection (list l, list m) ⇒ list
Generates a new set that is the intersection of two sets, l and m. l ∩ m.
First available: Version 1.3.2
set_union (list l, list m) ⇒ list
Generates a new set that is the union of two sets, l and m. l ∪ m.
First available: Version 1.3.2
set_difference (list l, list m) ⇒ list
Generates a new set that is the difference of two sets, l and m. l - m.
First available: Version 1.3.2
set_cartesian_product (list l, list m) ⇒ list
Generates a new set that is the Cartesian Product of two sets l and m. Output will be a list of lists. For example on two lists [1, 2] and [3, 4], the result will be [[1, 3], [1, 4], [2, 3], [2, 4]].
First available: Version 1.4.2F

Associative array functions

associative_array_get (associative_array a, object element) ⇒ mixed
If the associative array, a, contains the key, element, it will return the value associated to that key.
Alternative function names: map_get

Version 1.4.2 dropped the alternative name assoc_get and added the map_get alternative name.

First available: Version 1.3.4
associative_array_put (associative_array a, object key, object element) ⇒ associative_array
Adds an element, element, to the associative array, a with the key, key, and returns a new associative_array.
Alternative function names: map_put

Version 1.4.2 dropped the alternative name assoc_put and added the map_put alternative name.

First available: Version 1.3.4
associative_array_contains (associative_array a, object element) ⇒ boolean
Returns a boolean true or false if the associative array, a, contains the element, element.
Alternative function names: map_contains

Version 1.4.2 dropped the alternative name assoc_contains and added the map_contains alternative name.

First available: Version 1.3.4
associative_array_get_keys (associative_array a) ⇒ list
Returns a set of all keys contained in the associative array, a.
Alternative function names: map_get_keys

Version 1.4.2 dropped the alternative name assoc_get_keys and added the map_get_keys alternative name.

First available: Version 1.3.4
associative_array_flip (associative_array a) ⇒ associative_array
Flips the associative array a, turning keys into values and values into keys.
Alternative function names: map_flip

Version 1.4.2 dropped the alternative name assoc_flip and added the map_flip alternative name.

First available: Version 1.3.7.20

List & mathematical functions

get_minimum (real number1, real number2[, real number3, ..., real numberN) ⇒ mixed,
get_minimum (list num_list) ⇒ mixed
Determines the minimum of a specified list of numbers. Parameters can also be condensed to a single list.
Alternative function names: get_min|min
First available: Version 1.3.3
get_maximum (real number1, real number2[, real number3, ..., real numberN) ⇒ mixed,
get_maximum (list num_list) ⇒ mixed
Determines the maximum of a specified list of numbers. Parameters can also be condensed to a single list.
Alternative function names: get_max|max
First available: Version 1.3.3
get_range (real number1, real number2[, real number3, ..., real numberN) ⇒ mixed,
get_range (list num_list) ⇒ mixed
Determines the range of a specifed list of numbers. Parameters can also be condensed to a single list.
First available: Version 1.3.3
get_mean (real number1, real number2[, real number3, ..., real numberN) ⇒ mixed,
get_mean (list num_list) ⇒ mixed
Determines the average/mean of a specifed list of numbers. Parameters can also be condensed to a single list.
Alternative function names: mean|get_average|average
First available: Version 1.3.3
get_mode (real number1, real number2[, real number3, ..., real numberN) ⇒ mixed,
get_mode (list num_list) ⇒ mixed
Determines the mode of a specified list of elements. Parameters can also be condensed to a single list.
Alternative function names: mode
First available: Version 1.3.3
get_median (real number1, real number2[, real number3, ..., real numberN) ⇒ mixed,
get_median (list num_list) ⇒ mixed
Determines the median of a specified list of elements. Parameters can also be condensed to a single list.
Alternative function names: median
First available: Version 1.3.3

Image functions

image ([integer width, integer height) ⇒ image
Creates a new image with the specified width and height. If these are not specified, it defaults to 100 by 100 pixels.
First available: Version 1.4.3.40
file_open_image (string file) ⇒ mixed
Opens an image from a specified file and returns it. The image can then be manipulated using the language functionalities. It will return false if the file could not be found.
Alternative function names: open_image
First available: Version 1.3.5
file_save_image (image img, string file) ⇒ image
Saves an image, img, to a file path, file. The format is decided based on the extension.
Alternative function names: save_image
First available: Version 1.3.5.190
image_transform_greyscale (image img) ⇒ image
Takes in an image and transforms it with the greyscale filter.
Alternative function names: image_transform_grayscale
First available: Version 1.3.5.32
image_transform_sepia (image img) ⇒ image
Takes in an image and transforms it with the sepia filter.
First available: Version 1.3.5.32
image_transform_invert_colour (image img) ⇒ image
Takes in an image and transforms it with the inverted colour filter.
First available: Version 1.3.6.0
image_transform_resize (image img, integer width, integer height) ⇒ image
Takes in an image and resizes the image to the specified width and height parameters.
First available: Version 1.3.6.0
image_transform_rotate (image img, integer degrees) ⇒ image
Takes in an image and rotate the image to the specified degrees.
First available: Version 1.3.6.0
image_get_width (image img) ⇒ integer
Returns the width dimension of an image, img.
First available: Version 1.3.7.89
image_get_height (image img) ⇒ integer
Returns the height dimension of an image, img.
First available: Version 1.3.7.89
image_get_pixel (image img, integer x_coordinate, integer y_coordinate, [boolean associative]) ⇒ list
Returns a list which contains information about a single pixel. The list will contain the red (r), green (g), blue (b) and alpha data. If the associative variable is given a true value, the array will instead become an associative array: {r => red_value, g => green_value, b => blue_value, a => alpha_value}.
First available: Version 1.3.7.89
image_set_pixel (image img, integer x_coordinate, integer y_coordinate, list color) ⇒ mixed
This function sets a pixel in an image. If the set pixel operation fails, it returns the boolean value false. If the set pixel operation succeeds, it return the image. Any operation should be prepared for failure.
First available: Version 1.3.7.89
screen_grab () ⇒ image
Captures the screen of the computer at the point when the command is issued and returns it.
First available: Version 1.3.7.89

Date & time functions

compare_dates (Date date1, Date date2) ⇒ integer
Determines if a date is after, before or the same as another date. If it is the same it returns 0. If date1 is after date2 it returns 1. If date1 is before date2 it returns -1. Otherwise (e.g. one of the parameters is not of the correct type) it returns false or will throw an interpreter error.
First available: Version 1.4.0.83
difference_between_dates (Date date1, Date date2[, string format]) ⇒ integer
Calculates the difference between two dates. The value returned will be in days unless the format parameter is specified.
Alternative function names: date_diff
First available: Version 1.5.0
get_time ([string time_format]) ⇒ date
Gets the current system time and returns it in the format Tue Aug 02 22:00:00 BST 2016. This function replaces the constant value #time which was removed in version 1.3.7. Version 1.4.3.40 renames the function from get_time and adds the optional time_format parameter which allows a date to be formatted.
First available: Version 1.3.7.100

Specialised functions

csv_to_list (string data[, function f]) ⇒ list
Reads a string which consists of comma separated values and splits them on new lines and commas into a list of lists of values. The optional f parameter specifies some function that receives the value of each column to the function and obtains it's return value. This makes it easy to work on CSV files. The function must have at least one parameter.
First available: Version 1.3.5.80
json_to_map (string data) ⇒ mixed
Reads some JSON content and translates it to an associative array or list.
First available: Version 1.5.0 and renamed as json_to_object in version 1.5.3
object_to_json (mixed data) ⇒ string
Translates an associative array or list object into a JSON string.
First available: Version 1.5.3
generate_alphabet ([char start][, char end]) ⇒ list
Generates a list of lists containing an alphabet from A-Z and then a second list of a-z.
First available: Version 1.4.4

MySQL functions

mysql_connect (string host, string username, string password, string database) ⇒ mixed
Connects to a MySQL database using the Java MySQL plugin. On a successful connection it will return a connection of type MySQL_Connection and on an unsuccessful connection it will return the boolean false. The connection should be stored in a variable for future reference.
First available: Version 1.3.7.100

Deprecated and removed functions

return (object value) ⇒ void
From a function, this returns the value specified to the function call. As of version 1.3.7, return no longer requires the brackets around the value but they can still be used if required.
First available: Version 1.3.1

Removed as of version 1.5.3 in favour of the compiler keyword.

break () ⇒ void
Breaks the flow within the current construct, i.e. for, while, do etc.
First available: Version 1.4.3.10

Removed as of version 1.5.3 in favour of the compiler keyword.

object() ⇒ ZenObject
Creates a new ZenObject.
First available: Version 1.4.1.0

Removed as of version 1.5.3.

open_remote_client (string server, integer port) ⇒ integer
Opens a ZPE client on a specified port and at a specified server.
First available: Version 1.5.0

Deprecated as of version 1.5.1. This has been replaced by the main -n ZAC.

Removed as of version 1.5.2.

open_remote_server (integer port) ⇒ integer
Opens a new ZPE server.
First available: Version 1.5.0

Deprecated as of version 1.5.1. This has been replaced by the main -n ZAC.

Removed as of version 1.5.2.

string_concatenate (string text1, string text2[, string text3, ..., string textN]) ⇒ string
Joins two or more string together and returns them as a string.
Alternative function names: str_concatenate

Version 1.4 dropped support for concatenate, concat and Version 1.3.4 dropped support for join.

First available: Version 1.3.1

Deprecated as of version 1.4.4. You should use the & concatenate operator.

Removed as of version 1.5.2.

add (real val1[, integer val2, integer val3, ..., integer valN]) ⇒ real
Gets the value of val1 plus every other value as a real.
First available: Version 1.3.1.

Deprecated as of version 1.3.5.60. You should use the "Real Math Mode" or "LAMP" instead.

Removed as of version 1.3.7. More information.

subtract (real val1[, real val2, real val3, ..., real valN]) ⇒ real
Gets the value of val1 minus every other value as a real.
First available: Version 1.3.1.

Deprecated as of version 1.3.5.60. You should use the "Real Math Mode" or "LAMP" instead.

Removed as of version 1.3.7. More information.

multiply (real val1[, real val2, real val3, ..., real valN]) ⇒ real
Gets the value of val1 multiplied by every other value as a real.
First available: Version 1.3.1.

Deprecated as of version 1.3.5.60. You should use the "Real Math Mode" or "LAMP" instead.

Removed as of version 1.3.7. More information.

divide (real val1[, real val2, real val3, ..., real valN]) ⇒ real
Gets the value of val1 divided by every other value as a real.
First available: Version 1.3.1.

Deprecated as of version 1.3.5.60. You should use the "Real Math Mode" or "LAMP" instead.

Removed as of version 1.3.7. More information.

modulo (real val1[, real val2, real val3, ..., real valN]) ⇒ real
Gets the remainder of a real divided by a collection of real as a real.
Alternative function names: mod|remainder
First available: Version 1.3.1

Deprecated as of version 1.3.5.68. You should use the "Real Math Mode" or "LAMP" instead.

Removed as of version 1.3.7. More information.

increment (string variable_name [, integer value]) ⇒ integer
Increments a value and can have an optional value specified to increase it by more than one.
Alternative function names: inc
First available: Version 1.3.1.

Deprecated as of version 1.3.4.90. You should use $++var or add instead.

Removed as of version 1.3.6. More information.

decrement (string variable_name [, integer value]) ⇒ integer
Decrements a value and can have an optional value specified to decrease it by more than one.
Alternative function names: dec
First available: Version 1.3.1.

Deprecated as of version 1.3.4.90. You should use $--var or subtract instead.

Removed as of version 1.3.6. More information.

Running ZPE for Java

Running after using the configure.sh file

If you have used my configuration file linked up at the top, all you do now to run ZPE is type zenith:

Command line
zenith -i file.txt
										

Running it without installation

Both of these instructions include the Java argument -Xmx4g. This increases the maximum heap space given to the Zenith Parsing Engine to 4GB. This can be increased by changing the 4g to another number, such as 6g. So giving a maxmimum of 6GB of memory to the ZPE is achieved with -Xmx6g.

Windows

Open Command Prompt and type:

Command Prompt
cd directory_where_zpe_is
java -Xmx4g -jar ZenithParsingEngine.jar
										

Unix, Linux and Mac OS X

Open Terminal and type:

Bash
cd directory_where_zpe_is
java -Xmx4g -jar ZenithParsingEngine.jar
										

Modes

There are several modes available at present. The first argument is known as the ZPE Argument Command (ZAC). The ZAC is used to initiate specific modes on ZPE. The following list describes all the possible ZACs and their properties:

zpe -a $filename
Analyse code. Checks if the code is well-formed and valid.
zpe -c $file_to_compile [-n $class_name -o $output_file]
Compile mode. Compiles the code to a file for distribution. Version 1.5.1 makes the -n argument optional.
zpe -d $file_to_debug_path [-t $max_number_of_traverses -v $return_variable]
Debug code. Allows you to debug the code to a certain number of steps.
zpe -e $filename -o $file_out -n $class_name -t $language_type
Export mode. Exports code to another language. (experimental/alpha).
zpe -g
GUI mode. This mode features a basic GUI for editing and running code.
zpe -h $mode
Shows the available help commands and provides access to them. There are four options for $mode as follows: -h info which retrieves the information about ZPE program; -h doc -f filename [-s $function_name ] which will read any internal documentation within a compiled application; the -h cmd which lists all commands within the Zenith Engine when loaded.
zpe -i $file_path [-l $permission_level]
Interpreter mode. Compiles and runs code. Useful for detecting errors.
zpe -n $port [-l $permission_level -t $type, -c $command_mode]
Network remote server. Opens a ZPE Server or a ZPE Client. The $type allows you to use either 'server' or 'client' as options. In command mode (setting $command_mode to 'true') clients can execute commands on the server. The $permission_level parameter is used in this mode to set the level of access the client has.
zpe -q
Quickfire mode. A GUI single line read mode.
zpe -r [$code_string] [-m $mode] [-l $permission_level]
Interactive shell mode. -m is used to specify a type of shell to run, either multi or program are accepted.
zpe -s $file_path
String mode. Prints a string tokenisation of the program.
zpe -t $file_path
Tree mode. Prints the code tree of the code from a file.
zpe -v
Version number. Prints the current version number to the console.
zpe -man $entry_name
Manual mode. Searches out internal documentation for an internal function, much like the Unix man pages.
zpe $file_path
Runs a compiled ZPE application at a specified file path.

Example

Once Terminal (Mac and Linux) or Command Prompt (Windows) is open type the following on a file called input.txt that is valid ZenLang syntax:

Command line
java -Xmx4g -jar ZenithParsingEngine.jar -i input.txt
										

For Mac and Linux, you can create a file called zenith.sh with the contents (also do not forget to make the file executable with chmod 777 zenith.sh ):

Bash script
java -Xmx4g -jar ZenithParsingEngine.jar "$@"
											

For Windows, create a file called zenith.bat with the contents:

Batch file
java -Xmx4g -jar ZenithParsingEngine.jar "%*"
											

Below is one example:

Say you have downloaded the file on to your Windows Vista (or 7, 8.x, 10) PC into the Downloads folder. Your username is "Adam". You also have a script you want to interpret called test.txt that is in the Downloads folder. To run ZPE, you would simply:

Command Prompt
cd C:/Users/Adam/Downloads/
java -Xmx4g -jar ZenithParsingEngine.jar -i test.txt
											

You can also run commands straight from the command line to ensure it works by simply typing in the following:

zenith -r 'print("Range list: ", std_new_line(), range(10))'

This should print back to the terminal:

Range list:

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

Version 1.3.7 also included Unix manual pages, so man zenith will describe the whole product provided you have run the installer.

Video

The following video is a sample of the Zenith Parsing Engine running on a Mac.

Using arguments

Something that has been included in ZPE for a while is the ability to pass arguments from the command line.

A bit of extra work had to go in to convert these to proper arguments but at last, they work properly.

Bash
java -Xmx4g -jar ZenithParsingEngine.jar -i inputfile.txt [31, [434, 46]] \"argument1\" \"argument2\"
zenith -i testprog.zps \"Hello world\" [43, 99] 43
										

In order to use strings as variables, they must be enclosed in quotation marks, "", as strings.

Because of the way the system interprets arguments, it will remove the quotation marks unless they are escaped using \".

For example:\"Hello world\".

Alternatively, use single quotes to include a quoted expression such as ' "Hello" '

The following demonstrates how this works in ZenLang program:

ZenLang
function main($args)
	print($args)
end function
					
Unlike in certain other languages, the $args variable does not need to be specified on the main function, it will be given arguments if they exist regardless of whether the signature of the function is given the parameter $args or not.

You can download the standard library (stdLib.zex) from this link here. Place this file in the library folder (by default ~/.zpe/libraries/).

The following are example scripts. They are placed here from time to time and may not be fully functioning in the latest version of ZPE.

You can find more on my personal shared Dropbox folder here

FireFile listing

All files in this directory listed by FireFile

Files

If there are any faults within FireFile, please report them to me.

Since version 1.2.01, there have been 828 changes recorded in this changelog. From this tab you can read about any version number and the changes it brought to ZPE. Click on a zone below to find out more:

Version 1.2.01

    20.02.2015

    1. Added CLI support to BRS
    2. Added support for reading code in Zenith Engine
    3. Added file read support to BRS
    4. Translation process added
    5. Variable assignment added
    6. Print function added

    21.02.2015

    1. Evaluate function added
    2. String support added
    3. Added GUI mode [experimental] to BRS

    22.02.2015

    1. Global variables added
    2. Faster access to variables in Zenith Engine
    3. Custom commands added
    4. Functions added
    5. Call function added

    23.02.2015

    1. Added help command to BRS
    2. Added type output options
    3. Added return output options

    24.02.2015

    1. Added conditional statements
    2. Added if statements
    3. Added else statements

    25.02.2015

    1. Added add, subtract, multiply and divide functions
    2. Added modulo function
    3. Added sin, cos and tan functions

    26.02.2015

    1. Added variable reassignment
    2. Improved performance of conditional statements

    27.02.2015

    1. Added while loops
    2. Fixed an issue with if statements
    3. Added escape characters

    28.02.2015

    1. Added sqrt function

    01.03.2015

    1. Added the ability to overwrite Zenith Engine functions
    2. Added get_char_at function
    3. Added get_string_length function
    4. Added unix_runtime function

    02.03.2015

    1. Added get_constant function

    03.03.2015

    1. Added power function
    2. Added greater_than function
    3. Added less_than function

    04.03.2015

    1. Added comments
    2. Added set type
    3. Added set_contains function
    4. Added set_add_elements function
    5. Added set_get_length function
    6. Added set_union function
    7. Added set_intersection function
    8. Added set_difference function

    05.03.2015

    1. While loop improvements added

    06.03.2015

    1. Improved the speed of the interpreter
    2. Fixed an issue with strings

    07.03.2015

    1. Added a function line for running a single function

    08.03.2015

    1. Improved substitution of variables

    10.03.2015

    1. Added format_number

    18.03.2015

    1. Constants are now signified with an asterisk *
    2. Fixed a flaw in the substitution that prevented a variable being substituted if it was the last in a parameter string
    3. Added increment and decrement
    4. Added mode, median, mean, max, min and range
    5. The mode, median, max, min and range also work on both sets and numbers
    Version 1.3.0

      09.05.2015

      1. Complete redesign of core of Zenith Engine
      2. Improved parsing speed
      3. Redesign improves ease of creating new functionalities
      4. New and improved while statements
      5. Functions can now be nested in calls such as add(add(1, 1), 2)
      6. Variables can be assigned to function calls
      7. Interpreter speed improved
      8. Faster substitution
      9. Better unix_execute function speed

      10.05.2015

      1. Improved speed of condition testing
      2. Assignment of functions
      3. Tree parser added
      4. Compile feature added

      11.05.2015

      1. Logic (if and while) now supports nested functions
      2. Logic supports bracketed expressions within if and while statements
      3. Variables can now be assigned to each other: e.g. $j = $v
      4. Added parameter passing to functions

      12.05.2015

      1. Fixed a flaw in subtract which lead to the first number being removed twice
      2. Fixed a flaw in which conditional statements failed if a variable name is used
      3. Re-added file_open function
      4. Added file_exists function
      5. Re-added random_number function
      6. It is no longer necessary to specify an output file in compilation. If there is no output specified it defaults to out.brs.
      7. While loops can be ended by either end while or end loop

      13.05.2015

      1. Variables can be assigned to logical evaluations, such as $v = (true || false). All expressions must be bracketed.
      2. Comments can be included after code on the same line (all programs need recompiled)
      3. Added multi line comments with the /* */ representation
      4. Added absolute_value function

      14.05.2015

      1. Added string_contains
      2. Sets are now working as definitions and as parameters
      3. Fixed a flaw when compiling without an output file
      4. There is no longer the requirement of spaces between variable declarations and comparisons
      5. Added elseif statements to if statements
      6. Added recursion restriction on functions
      7. Program is more friendly to files not found

      18.05.2015

      1. Added get_type function
      2. Added set_intersection function
      3. Added set_union function
      4. Added list_add function
      5. Added list_remove function
      6. Added list_contains function
      7. Added set_from_list function
      8. Added list_get_index_at function
      9. Added list_get_length function
      10. Fixed a flaw in which empty sets cannot be defined
      11. Conditional statements now support comparison of sets
      12. Added get_minimum function
      13. Added get_maximum function
      14. Added get_range function
      15. Added get_mean function
      16. Added greater_than function
      17. Added less_than function
      18. Fixed a problem in which an empty string cannot be represented
      19. Added get_mode function
      20. Fixed a flaw in which a string would be added as a name to a function
      21. Another flaw fixed with return function
      22. Another flaw fixed on the return function to exit functions
      23. Fixed a problem in which numeric values were surrounded by quotes within sets
      24. Fixed an issue with the list_remove function which would only remove numbers equal to the position to remove from
      25. Added list_insert_at_index
      26. Language checks now check for accidental semicolons at the end of lines

      19.05.2015

      1. Added for loops for($i = 1, $i < 10, 1)
      2. Added char_to_int to convert a character to an integer
      3. Added int_to_char to convert an integer to a character

      20.05.2015

      1. Added permission mode. Levels can be defined using arguments on the -i and -r modes.
      2. Added is_file function
      3. Added is_directory function
      4. Added directory_exists function
      5. Fixed an issue where parameters would be read over local variables
      6. For can now be assigned to another variable e.g. for($i = $j, $i < 10, 1)
      7. For now deletes variables after the for loop

      21.05.2015

      1. Added do until loops
      2. Added the round function
      3. Added the factorial function
      4. Added -m multiple line interpreter mode
      5. Added get_median function
      6. Added list_sort function
      7. Added list_reverse function
      8. Added list_swap_elements function
      9. If statements and loops can have empty bodies
      10. Minor fixes that make it easier to develop small empty statements
      11. Added select-when statements
      Version 1.3.2

        22.05.2015

        1. Pass parameters from function line to program
        2. Added is_numeric function
        3. Added string_split function
        4. Added string_find_occurrences function
        5. Added string_get_substring function
        6. Added get_os_name function
        7. Added string_to_lowercase function
        8. Added string_to_uppercase function

        25.05.2015

        1. Added a simple graphical user interface to the engine

        05.06.2015

        1. Changed the output of errors to stderr rather than stdout
        2. Added the std_error function
        3. Fixed a flaw with when statements that caused strings to evaluate incorrectly
        Version 1.3.3

          06.06.2015

          1. Added internal local functions (functions defined within functions)
          2. Due to minor changes, the constant character is no longer * but #
          3. Added string_ends_with function
          4. Added string_starts_with function
          5. Added string_matches function

          07.06.2015

          1. Added associative arrays
          2. Added associative_array_get function
          3. Added associative_array_put function
          4. Added associative_array_contains function
          5. Fixed the problem occurring with adding arguments to programs

          10.06.2015

          1. Added the import function to import compiled scripts
          2. Changed the way scripts compile
          3. Boolean expressions can now be assigned to variables without bracketing
          4. Logical expressions can now be passed to functions

          11.06.2015

          1. Fixed an issue with boolean expressions given to functions
          2. Added the invert_value function
          3. Fixed a flaw in which negative numbers were some times discarded as not being integers
          Version 1.3.4

            12.06.2015

            1. Error messages are more useful with the compiler and interpreter
            2. ZPE automatically adds all scripts found in the "libs" folder
            3. Fixed an issue with constants not being recognised

            13.06.2015

            1. Fixed the arguments system

            15.06.2015

            1. Added the list_update_at_index function
            2. Changed the greater_than function to the greater_than_all function
            3. Changed the less_than function to the less_than_all function
            4. Added the equals_any function
            5. Added the to_binary function
            6. Added the to_octal function
            7. Added the to_hexadecimal function
            8. Added pre-increment tools
            9. Added pre-decrement tools
            10. Added post-increment tools
            11. Added post-decrement tools
            12. Certain functions cannot be overridden. More at http://www.jamiebalfour.com/software/zenith/
            Version 1.3.5

              15.06.2015

              1. Modified the increment and decrement tools syntaxes
              2. Added the file_get_size function
              3. Fixed a flaw in which doubles could not be incremented

              19.06.2015

              1. Fixed a flaw in which conditions and parameters would not work correctly with post increments and post decrements
              2. Improved constants. Constants can also be defined if they are not already defined, but they cannot be overwritten.
              Version 1.3.5.32

                20.06.2015

                1. Added support for numbers with exponents, symbolised by an E
                2. Fixed a flaw in which post decrement and post increment did not function as expected

                28.06.2015

                1. Added file_open_image function
                2. Added limit_real function
                Version 1.3.5.60

                  29.06.2015

                  1. Fixed a problem with heap space
                  2. Added recursion support again
                  3. Added image_transform_greyscale function
                  4. Added image_transform_sepia function
                  5. Added Real Math Mode mathematical evaluation

                  30.06.2015

                  1. Negative numbers can be included in mathematical expressions
                  2. Fixed a flaw in which substitution did not take place
                  3. Fixed a flaw in which variables could not be assigned to an incrementing or decrementing value
                  4. Changed the way increment and decrement work under the hood
                  5. Added mathematical evaluation to conditional statements
                  6. Fixed a minor flaw that affected condition checking
                  7. Added run_command function to run commands on the fly
                  8. Fixed an issue with permission levels
                  9. Added bracketed mathematical expressions
                  10. Fixed a flaw in the bracketed expression evaluation
                  Version 1.3.5.68

                    30.06.2015

                    1. Added modulo calculations to mathematical expressions
                    2. Fixed another flaw in the mathematical evaluation
                    3. Added backtracking requirement for mathematical evaluation
                    4. Removed backtracking requirement previously added
                    5. Fixed several more flaws in mathematical evaluation
                    6. Fixed an issue in which numbers with decimal places would cause a crash when incremented or decremented

                    01.07.2015

                    1. Added support for constants into mathematical evaluation
                    2. Fixed a flaw in which mathematical evaluation could only be done once
                    3. Fixed an issue with subtraction
                    4. Cleared up a lot of bugs in the RMM evaluator.
                    Version 1.3.5.90

                      02.07.2015

                      1. Fixed a bug with pre-increment and pre-decrement
                      2. Added increment and decrement values to math evaluation
                      3. Fixed an issue with subtraction in mathematical evaluation
                      4. Added the -math mode for mathematical evaluation
                      5. Added mathematical evaluation to associative arrays and lists
                      6. Fixed a bug with the exit function in the -math mode

                      07.07.2015

                      1. Added the conversion option. It currently only supports very basic conversion to Java.
                      2. Fixed an issue with mathematical evaluation
                      3. Updated the start up information with the new -c mode as well as the -doc mode.
                      Version 1.3.5.190

                        08.07.2015

                        1. Added the unset function for removing variables after use

                        09.07.2015

                        1. Added the file_save_image function for saving images
                        2. Fixed an issue that prevented using global variables that used lists, associative arrays, structure and so on
                        Version 1.3.6.0

                          10.07.2015

                          1. Added structures
                          2. Added structure variables
                          3. Added structure functions

                          11.07.2015

                          1. Added structure variable assignment
                          2. Added structure variable access methods
                          3. Removed increment function
                          4. Removed decrement function
                          5. Added pointer evaluation to parameters, conditions and function calls
                          6. Fixed a flaw in which parameters of more than length 1 would not function
                          7. Fixed an issue with associative arrays

                          12.07.2015

                          1. Fixed an issue with for loops in which assignment caused a crash if the assignment was evaluated
                          2. Added the image_transform_resize function

                          15.07.2015

                          1. Added the image_transform_invert_colour function
                          2. Added the image_transform_rotate function
                          3. Fixed an issue with the is_set command evaluating incorrectly
                          4. Fixed an issue with structure
                          5. Added the start function (identical to the main function)
                          Version 1.3.7.0

                            21.07.2015

                            1. Plugin system is functioning now, Java-based plugins can be written
                            2. Removed the add function
                            3. Removed the subtract function
                            4. Removed the multiply function
                            5. Removed the divide function
                            6. Removed the modulo function

                            22.07.2015

                            1. Added handle_of function to obtain a function handle from the function name
                            2. Return no longer requires brackets around the value, this is optional

                            25.07.2015

                            1. Added library support
                            2. Added support for semi-colons in for loops as well as commas

                            26.07.2015

                            1. Fixed a flaw in which variables would be incorrectly updated
                            2. Added the list_is_a_set function
                            3. Added the associative_array_flip function
                            4. Fixed an issue with substitution of variables and associative arrays
                            5. Added the string_is_uppercase function
                            6. Added the string_is_lowercase function
                            7. Added the significant_figures function
                            8. Added another minor fix to the unset and is_set functions

                            27.07.2015

                            1. Added an optional parameter to the directory_list_files function to find only specific file types
                            2. By specifying no directory, ie. "" to the directory_list_files function, it uses the current directory
                            Version 1.3.7.44

                              04.08.2015

                              1. Added lambda functions that can be assigned to variables: e.g. $foo = function($x){return $x * $x}
                              2. Added pointer support to evaluation
                              3. Added pointer support to function parameter evaluation
                              4. Fixed a flaw that stopped increment and decrement working
                              Version 1.3.7.72

                                05.08.2015

                                1. Made a few changes to the workings of lambda functions
                                2. Lambda functions can be passed as parameters to functions and conditions
                                3. Fixed a flaw with variable storage
                                4. Variables can now be assigned to other variables which themselves are lambda functions
                                5. Added lambda functions to for each loops
                                6. Added lambda functions to for loops

                                11.08.2015

                                1. Fixed a minor flaw with lambda calls
                                2. Added the Function type to the get_type command
                                3. Added the list_local_variables function
                                4. Added the list_parameters function
                                5. Added the list_global_variables function

                                13.08.2015

                                1. Added the screen_grab function

                                15.08.2015

                                1. Added the image_get_width function
                                2. Added the image_get_height function
                                3. Added the image_get_pixel function
                                4. Added the image_set_pixel function

                                18.08.2015

                                1. Added the all_true function
                                2. Added the all_false function
                                3. Added the any_true function
                                4. Added the any_false function

                                19.08.2015

                                1. Changed the type:$language requirement on the -c mode to $language.

                                20.08.2015

                                1. Added the global function to push a local variable to a global
                                2. Added several new constants
                                3. Added the mysql_connect function
                                Version 1.3.7.100

                                  27.08.2015

                                  1. Fixed a flaw in which lambda functions would not function if they were the first parameter
                                  2. Fixed an issue with returning lambda functions
                                  3. All list and associative array functions now copy the original list or array before modification
                                  4. Fixed an issue with logical comparisons
                                  5. Added logical comparison evaluation to parameter checker
                                  Version 1.4.0

                                    29.08.2015

                                    1. Major restructure of internal core of interpreter for better hash functions
                                    2. Internal aliases are now fully implemented and much easier to execute
                                    3. Internal documentation is built-in to core functions
                                    4. Internal documentation is required on extension functions and libraries
                                    5. Minimum parameter requirement is now built-in to extension functions and libraries
                                    6. Minimum permission level requirement is now built-in to extension functions and libraries

                                    30.08.2015

                                    1. Added the echo alias
                                    2. Readded the round command
                                    3. Negation can now be applied through the ! function
                                    Version 1.4.0.83
                                    1. Added compare_dates function to compare two dates
                                    Version 1.4.1

                                      21.10.2015

                                      1. A few minor updates

                                      29.11.2015

                                      1. Added the range function to generate a list of numbers in a range
                                      2. Memory usage lowered slightly

                                      04.12.2015

                                      1. Added the counter function to generate an associative array of counts of items in a list
                                      2. Added the object function to generate a new Object
                                      3. Added the dotted expressions. $x.$y = 10 and print($x.$y)

                                      06.12.2015

                                      1. Out of order arguments can now be passed to the application. The only change is now that they require an argument name before.
                                      2. The new clean arguments system works with application arguments better
                                      3. Functions can be made private or public
                                      4. ZPE programs are now compiled to ZEX (Zenith Engine Executable) files

                                      09.12.2015

                                      1. Fixed a bug with the is_set command which would always return false
                                      2. Fixed a bug that stopped the return function working
                                      3. Anonymous functions have been improved
                                      4. Major improvement to lambda functions that makes them function better
                                      5. Fixed a bug with condition compilation
                                      6. Lambda functions now have scope to read global and parent variables
                                      7. Fixed a flaw that made the get_input function the same as the print function

                                      11.12.2015

                                      1. Added publicly accessible isFunction and isObject methods to the JAR as requested

                                      14.12.2015

                                      1. Images can now be compared using the equals sign, e.g. $img1 == $img2
                                      2. Removed dotted expressions in favour of using the pointer. E.g. $x = object() $x => $y = 10
                                      3. Added lambda functions to variables in structures
                                      4. Improved modularity of ZPE
                                      5. The file_create_directory function is now the directory_create function

                                      15.12.2015

                                      1. Function chaining is now supported. E.g. range(0, 40).list_get_length()
                                      2. Fixed a bug where the . would break strings
                                      3. Added the length function which will work on strings, lists and associative arrays
                                      4. Added the get function which will work on strings, lists and associative arrays
                                      5. Fixed an issue with conditions being evaluated incorrectly
                                      6. New -experimental mode
                                      7. Added a compiler_version number to compiled scripts
                                      Version 1.4.2

                                        16.12.2015

                                        1. Improved efficiency with structure variable assignment
                                        2. Scripts without any functions at all can be run as a single program

                                        20.12.2015

                                        1. Added compiler type checking when using the typed system
                                        2. Added the string, integer, boolean, structure, lambda, object and image types
                                        3. Types are always case insensitive
                                        4. Finally added the configuration file for setting options

                                        22.12.2015

                                        1. The range function now can take numbers with decimal places in them, e.g. range (99.1, 1000.4)
                                        2. Added an increment parameter to range function, e.g. range(99, 1000, 0.3)

                                        14.05.2016

                                        1. Added the new list_pop and list_dequeue functions

                                        28.05.2016

                                        1. Added lazy evaluation to condition evaluation

                                        31.05.2016

                                        1. Fixed a flaw with the random_number function that added the minimum as a string

                                        05.06.2016

                                        1. Conditional words like and, or and xor are compiled as their logical counterparts (&&, || and **)

                                        07.06.2016

                                        1. The echo command does not need brackets around parameters, but it will only take a single parameter. e.g. echo "Hello"
                                        2. Fixed a flaw in which functions compiled under the case insensitive compile option would not function correctly
                                        3. Added the config option to the -h mode to display all the user's configurations (or properties)

                                        16.06.2016

                                        1. Fixed an issue that meant that true at the end of a statement would not be evaluated. E.g. '(10 < 15 && (15 > 15 || 20 > 20)) || true' would return false

                                        18.06.2016

                                        1. Added set_cartesian_product function

                                        27.06.2016

                                        1. Compiler improvements
                                        2. Updated manual command for get_type
                                        3. Updated website information to jamiebalfour.com/projects/zenith/
                                        4. The put, length and get commands are no longer experimental but fully implemented. They work as [43, 22].length() which will give 2.

                                        01.07.2016

                                        1. Added the ternary condition operation. E.g: $x = 10 > 20 || 20 > 10 ? "Yes" || "No" will set the value of $x to "Yes".
                                        Version 1.4.3

                                          13.07.2016

                                          1. The biggest change in ZPE history has begun: rewriting the original condition and mathematical parsers and evaluators

                                          16.07.2016

                                          1. The mathematical parser has been rewritten into the same parser as the logical one
                                          2. Resurrected the ternary (?) operator and operation on logic
                                          3. Added a compiler failure on the ternary operator on mathematical expressions

                                          17.07.2016

                                          1. Added the improved evaluator for comparison. This works around 3 times as efficiently as the previous one on larger statements
                                          2. The new evaluator is flaky and not fully tested, so use this version with caution
                                          3. Major fix with chaining

                                          19.07.2016

                                          1. XOR has been removed, but a function has been added in its stead
                                          2. Fixed an issue whereby the compiler seeing a comparator (==, > etc.) would force it to read only one symbol ahead
                                          3. Fixed an issue where comparison and mathematics mixed together, e.g. 5 > 2 + 1, would crash the interpreter
                                          4. Fixed an issue within LAMP where a bracket expression would return a number. E.g. (true == false) would return 0
                                          5. Fixed an issue that prevented return functions from working properly
                                          6. Function chaining has been fixed

                                          20.07.2016

                                          1. Fixed an issue in which bracket expressions were incorrectly tested

                                          21.07.2016

                                          1. Fixed a few minor issues that caused compile issues
                                          2. Improved the LAMP compiler
                                          Version 1.4.3.10

                                            22.07.2016

                                            1. Improved the security of certain functions
                                            2. Reduced possibility of a memory leak in some functions
                                            3. Added the break function

                                            24.07.2016

                                            1. Added scopes (private, public and friendly) support to variables
                                            2. Added the scopes to constants as well

                                            25.07.2016

                                            1. Improved the efficiency of the compiler

                                            27.07.2016

                                            1. Merged structures and object types into one larger type
                                            2. Fixed issues with structures that prevented them from functioning
                                            3. Fixed an issue with boolean variables in a logical statement
                                            4. Minor fix with lambda functions within objects

                                            28.07.2016

                                            1. Changed the way in which the interpreter functions (less recursion) - leading to better performance and memory usage

                                            29.07.2016

                                            1. Fixed a small issue that caused lambda functions to crash

                                            30.07.2016

                                            1. Fixed an issue in which lists and associative arrays would not be evaluated properly in a comparison

                                            01.08.2016

                                            1. Fixed an issue with the ternary operator on single expressions
                                            Version 1.4.3.40

                                              02.08.2016

                                              1. Fixed an issue with lambda functions that prevented them from being evaluated when given parameters on declaration
                                              2. Modularised the for loop
                                              3. Added the sha1, sha256 and md5 hashing algorithms

                                              03.08.2016

                                              1. Added the try and catch clause to catch errors
                                              2. Better error handling and few Java like errors
                                              3. Another fix with the ternary operator makes them function better

                                              04.08.2016

                                              1. Better error messages from the compiler

                                              05.08.2016

                                              1. Added the plus equals (+=) and the minus equals (-=) increment and decrement operators
                                              2. Added the concatenation operator, & and deprecated the string_concatenate command

                                              06.08.2016

                                              1. Fixed an issue with variables and increment and decrement values
                                              2. Fixed an issue with anonymous functions and return functions without brackets
                                              Version 1.4.4.0

                                                07.08.2016

                                                1. Focuses on external implementation of language converters

                                                12.08.2016

                                                1. Expressions can now be negated by simply putting the ! in front of them without bracketing it. E.g. !false
                                                2. Added the list_get_at_random_index and the generate_alphabet methods

                                                14.08.2016

                                                1. Fixed an issue with the += and -= increment and decrement values that only allowed numbers to be used
                                                2. Fixed an issue with the += and -= increment and decrement values that meant that values were rounded to integers not left as reals
                                                Version 1.5.0

                                                  08.12.2016

                                                  1. Fixed an issue with the LAMP compiler
                                                  2. Fixed an issue with the LAMP interpreter
                                                  3. Fixed an issue with the ternary operator, that stopped it functioning on the false value

                                                  10.12.2016

                                                  1. Added json_to_map function

                                                  11.12.2016

                                                  1. Added interpreter warnings

                                                  17.12.2016

                                                  1. LAMP parser memory consumption improved considerably
                                                  2. Fixed an issue with lambda functions not evaluating correctly in LAMP expressions
                                                  3. Added the 'this' keyword for pointers. E.g. $x => $y = function(){ print (this => $z) }

                                                  21.12.2016

                                                  1. Fixed an issue in which the ceiling command would round down

                                                  07.01.2017

                                                  1. Improved server and client communication and functionality
                                                  Version 1.5.0.1

                                                    08.01.2017

                                                    1. Further improved server and client communication, now allowing the server to execute a script on the input.
                                                    2. Added the string_cut function that cuts a string from start to finish
                                                    3. Added the string_divide function to split a string multiple times

                                                    10.01.2017

                                                    1. Added threaded lambda functions. $v = threaded function() { for ($i = 0; $i < 100000; $i++) print($i) end for }

                                                    11.01.2017

                                                    1. Fixed an issue in which lambda calls were not called in a LAMP expression
                                                    2. Fixed an issue in which the global #SCRIPT constant is not defined a associative array properly
                                                    Version 1.5.1

                                                      14.01.2017

                                                      1. Added the includes statement. This will include non-compiled code before compilation. E.g. include "file.txt". This code will execute as though it were in the main program

                                                      16.01.2017

                                                      1. Added the publicly available PublicMethods class and the built in ExternalMethods variable to access it which allows access to a bunch of useful functions to access internals of ZPE
                                                      2. Changed the plugin interface slightly, it now sends a 'parent' ZenithEngine object to the MainMethod of an interface
                                                      3. Improved performance and fixed a flaw in which plugins could not be executed
                                                      4. Added the for-to loop e.g. for($i = 0 to 10). Works the same way underneath

                                                      21.01.2017

                                                      1. Added compiler improvements that make compiled applications run faster
                                                      2. The name parameter in the compiler is now fully optional

                                                      22.01.2017

                                                      1. A huge number of changes designed to make it easier to use ZPE within the Java language by organising ZPE into packages jamiebalfour.ZPE

                                                      31.01.2017

                                                      1. Fixed an issue with concatenation
                                                      2. Added do while loops
                                                      Version 1.5.2

                                                        07.02.2017

                                                        1. Added custom keyword plugin feature. This allows custom parsing of symbols and words

                                                        13.02.2017

                                                        1. Added the serialise and deserialise functions to object $v = object() $v => $x = 10 $v.serialise("Test")
                                                        2. Improved the serialise and deserialise functions to now support functions, objects within objects, lists and associative arrays

                                                        14.02.2017

                                                        1. Structures can now be initalised through a constructor function called _construct
                                                        2. Fixed an issue where objects within objects could not be used.
                                                        Version 1.5.3

                                                          14.02.2017

                                                          1. Added the get_object_definition function, designed to identify which structure this object inherits it's format from
                                                          2. Added the wait method which waits a specified number of milliseconds

                                                          15.02.2017

                                                          1. Improved server stability
                                                          2. Pointers have been renamed accessors. The accessor symbol is still =>

                                                          21.02.2017

                                                          1. Added a new feature that allows function declaration within objects. $x => f = function() print("Test") end function
                                                          2. Added the _output core method to objects. Any object declaring an _output method will call this when cast to a string

                                                          22.02.2017

                                                          1. Fixed an issue in which foo = function() { print("bar") } would be a valid function
                                                          2. Objects are better inlined with structures, the 'object()' function is removed and replaced with the 'new object()' syntax.
                                                          3. Chainable functions can be used on accessors such as $people => $list.get(1). This is a minor fix.

                                                          23.02.2017

                                                          1. Fixed an issue within the compiler, whereby all inner compiled strings would be case insensitive.

                                                          24.02.2017

                                                          1. Fixed a couple of minor issues in regards to scope
                                                          2. Completely redesigned the parser, making it separate to the main compiler.
                                                          3. Added JBSON, my own JSON parser.
                                                          4. Fixed an issue that has been around for a long time with string quotes not being removed by moving this to the parser

                                                          26.02.2017

                                                          1. Continuing with the idea of a reusable parser, the CSV parser has been redesigned from the bottom up

                                                          21.03.2017

                                                          1. Associative arrays no longer use braces {} but [] similarly to lists
                                                          2. To access an internal method of an object the -> is used instead of => (=> is used for associative arrays only)

                                                          26.03.2017

                                                          1. Added the option to ignore new lines in the ZPE Parser
                                                          2. Fixed a flaw that prevented objects from being parsed properly

                                                          28.03.2017

                                                          1. Added the index of an array through square brackets $v[1] for access only
                                                          2. Minor performance improvements and further refactoring

                                                          29.03.2017

                                                          1. Added ZPE to a Git repository for better backtracking

                                                          30.03.2017

                                                          1. Added the new index assignment through $v[2] = "Hello"
                                                          2. Added index support for associative arrays
                                                          3. Added index setting support for associative arrays $v["Tom"] = "Allan"
                                                          4. Improved the way the compiler works, improving performance
                                                          5. Improved the shell command to now return the return value of the command
                                                          6. Added the sprintf function to format a string fairly quickly
                                                          Version 1.5.4

                                                            31.03.2017

                                                            1. Added the new object declaration format similar to JSON or JavaScript: $v = {first_name : "Jamie", surname : "Balfour"}

                                                            01.04.2017

                                                            1. Improved the parser to support any third-party subsequent character array

                                                            02.04.2017

                                                            1. Redesign of the way objects are accessed that makes them a little unstable
                                                            2. Fixed the issue with accessors and objects, making them stable again

                                                            05.04.2017

                                                            1. Added a fix to concatenation that will need to reviewed ASAP

                                                            Contributions

                                                            The following software and/or components were used in the production of ZPE:

                                                            • Java BECL (Balfour's Enterprise Class Library) - used for the image effects amongst many other helper functions.
                                                            • Google's GSON library - used for parsing JSON to a Java HashMap which is then converted to a Zenith Associative Array.

                                                            The following people are to thank for their contributions to the development of ZPE:

                                                            • Julian Merlin Ertel - major contributor through major testing. Without any doubt the biggest external tester of ZPE, all the way from version 1.3.

                                                            Known bugs

                                                            The following list are known bugs in the latest version. Fixes are currently being looked at. The bugs with an exclamation mark (!) after the number are priority bugs. I will leave all bugs from version 1.5.3 in this list and update them as I or someone else manages to fix them.

                                                            Bug number Description Fixed
                                                            #1! Modular arithmetic does not always give the correct result
                                                            #2! Arithmetical evaluation on inner object values does not work 2017-03-28
                                                            #3 MySQL functions no longer work
                                                            #4 Concatenation with access of objects (e.g. $x -> $y & $x -> $z) does not work
                                                            #5 ZPE needs to handle errors in code better and not crash when the compiler finds a fault.
                                                            #6 ZPE Parser needs to work on comments more flexibly, not binding itself to a single style of comments (// and /* */ are currently the only supported options)

                                                            Comments

                                                            Please do not use any offensive words in your comments.

                                                            Site accessibility

                                                            A lot of the original functionalities that once existed here have been removed.

                                                            This page was generated in 0.46 seconds using 2097152 bytes. Slow? Let me know.

                                                            To use project mode, the window must be greater than 920 pixels in width.
                                                            Click here to disable Project Mode.
                                                            This site uses cookies to deliver its services, to personalise ads, to store preferences and to analyse traffic. Information about your use of this site is shared with other companies. By using this site, you agree to its use of cookies.
                                                            Contact me
                                                            Contact Jamie Balfour

                                                            Get in touch with me via this form.