To use this website fully, you first need to accept the use of cookies. By agreeing to the use of cookies you consent to the user of functional cookies. For more information read this page.

Personal Blog

It's about time. ZPE has finally has a web server. A few years ago I added a communication server to ZPE (I think it was added in version 1.5.x) that allowed two or more ZPE programs to communicate using XML requests. It was great and it was reasonably fast.

But since then, ZPE has become so fast that I decided to write a server. This server uses ZPE as the main syntax for everything and because it's parser has been improved so much it's fast (maybe not as fast as PHP or C based applications, but it's good overall).

YASS
<!doctype html>
<html>
  <head>
    <title>Test ZPE</title>
  </head>
  <body>
    This is <?zpe print("Jamie") zpe ?> here.
    <?zpe
      for($i = 0; $i < 100; $i++)
print("<p>Hello " & $i & "</p>")
end for zpe ?> </body> </html>

ZPE has always been aiming to get to the point of doing this, since I consider myself more a web developer than software developer nowadays, I wanted to get something like this.

ZPE's main advantage is it's library of features, plus the ability to write extremely fast functions into the language  and it's already existing standard library.

To be clear version 1.6.x added the web parser to ZPE (the -w ZAC), but it wasn't fast enough for me until I updated the parser to version 1.3.

I'm extremely happy to announce after a lot of thinking and redesigning, ZPE 1.3 is now included in version 1.7.1 of ZPE and later. The new version of the parsing engine offers much faster and more efficient parser than ever before.

The results are in:

ZPE 1.7.1 with the old parser (version 1.2.1):

real 0m0.668s
user 0m1.390s
sys 0m0.152s

Compared with ZPE 1.7.1 with the new parser (version 1.3.0):

real 0m0.595s
user 0m1.270s
sys 0m0.136s

This may only be a 10% increase overall, but in reality this is big news. Minor improvements for the standard library run and compile but for interpreting JSON, CSV and XML files amongst other file types, this is an incredible amount of speed.

As mentioned over and over, the parser is by far the fastest part of the compilation process since the ZenithParser has been the main focus for years within ZPE.

Another major improvement in the ZenithParser 1.3 is it's ability to handle whitespace better and allow the compiler to re-add whitespace later. This has had incredible use within the ZPE web parser.

ZPE's implementation of by reference variables was a tricky one since the underlying Java does not give access to such a powerful tool.

Since version 1.7.0 Reindeer Lake, which was officially released yesterday, ZPE has supported by reference variables and will continue to make them more powerful. As these are new, there is currently no documentation on them. I will add some soon. In the meantime, I thought it might be a good idea to use my blog to explain these in more detail.

ZPE/YASS by reference is achieved with a ZPEVariableReference object which points to an actual ZPEVariable. Changes can be made to overwrite these in functions or to overwrite just their value. A change to the value will change the original value. Let's see it with code:

YASS
function main()
 
  $y = 5
  j(&$y)
  print($y)

end function

function j($y)

  $v = $y + 10  
  print($v)

  &$y = 10  
  print(&$y)

end function

Notice the changes between using &$ and just $. If using the $ syntax in an assignment, it will destroy the reference. Also note, the parameter name is still just $y, even though it contains a pointer. To access the parameter $y as though it were a pointer, it is simple enough to just put an & in front of it as shown on line 14.

That's all there is to ZPE by reference variables so far. I will continue to improve them over the next few versions so keep an eye out!

Over 2018, ZPE has improved more than ever. Here is just a sample of the new language features brought through the year 2018:

  • Performance is better than ever.
  • The syntax is cleaner than ever.
  • Its name is now a recursive acronym and much easier to say.
  • It's more object-oriented than ever before. Object inheritance was added. Objects performance has been improved.
  • TYPO was finally brought to the language.
  • Native methods for objects were brought to the language.
  • Error objects were added.
  • Pre-increment and pre-decrement syntaxes were changes to be in line with other languages such as PHP - this was one of the most requested features back in the early days of ZPE. 
  • A new FOR LOOP, the FOR EACH IN LOOP was added.
  • The circumflex (^) for representing the power value, e.g. 5^2 is now part of the syntax
  • More syntactic sugar was added to the compiler, such as the IF...THEN statements. The fat arrow syntax for lambda functions was added. elseif can now be written as else if as well.
  • Value caching with the cache_value and read_cache allow programs to save information for later.
  • If statements can have values assigned within them. E.g. if(($v = 10) == 10) 
  • Python-style fixed arrays have now been added
  • The interactive interpreter has been improved by miles - it performs better and doesn't stop when it has an error.
  • Further refinement to 'everything is a function' strategy where the whole program runs within a function has been furthered.
  • The internal updater has now been added

What's still left for development in 2019 then? Well, the answer is that there is a ton of stuff still to be done. For a start, I'd like to improve the performance of the LAMP parser considerably. There is definitely scope for improvement there. It will be a drop in replacement for the current LAMP parser too since the LAMP parser implements the ZPELAMP interface.

ZPE will also get the automatic update feature brought to it, so it will inform users when there is an update. The GUI object is also going to be one of the main focuses for the next version of ZPE. As well as that, ZPE will move further to becoming an object-oriented language by furthering the number of object-based methods within the language. 2018 also added a Python transpiler, I will continue to work on that and hopefully finish that.

What happened to ZPE 2.0?

ZPE 2.0, the C++ compiler, interpreter and runtime that was designed to replace ZPE 1.x was going to take too long to develop and I'm quite happy to work on ZPE 1.x for now as my main project. In the future I will possibly continue to work on ZPE 2.0 again.

A long-awaited feature in the ZPE was the request for an updater built-in to the interpreter and parser. So now with ZPE 1.6.8.1 you can, although a minor update, it is actually a big update for it.

This is a long awaited feature and it's very easy to do. ZPE 1.6.8.1 is now also available to download from my website as of today. To run the update, simply type:

zpe --update

By reference-style variables have yet to be fully implemented and are partially implemented in ZPE 1.6.8.x. They've been disabled within the release versions.

With 2019 just around the corner, ZPE 1.7.0 is also just about ready to be started and readied for release. ZPE 1.7.0 is bringing some performance improvements and one or two new syntax features that aim to make ZPE even better. ZPE 1.7.0 will also bring an automatic updater, expanding on what ZPE 1.6.8.1 brought. Unfortunately, ZPE 1.6.9 which I had hoped to bring out before the end of the year, has been scraped due to the lack of time.

ZPE has very recently made objects a staple part of the language. But did you know that all variables within an object are actually references? What I mean is that if you change a variable (property) within an object in ZPE it will actually update the object.

YASS
$o = {$x : 10}
//Will print 10
print($o->$x)
$o->$x = 50
//Will print 50
print($o->$x)

So what does this mean and just how can it be brought further into ZPE? Well this exact concept will be used in ZPE 1.6.8 (December 2018) to bring forward by reference variables. These variables have sort of existed since some version 1.5.x but have found very little use. They work on a different system to ordinary variables however and a system of trust between the function itself returning what is necessary.

Whether or not ZPE 1.6.8 completely adds support for by reference or not is dependent on how much I manage to get done with regards to it, but I can say for a fact that it will be very useful as both a learning tool and as a feature of the language when it is done.

ZPE 1.6.7 is definitely set to make an uproar in comparison to many of it's predecessors. That's because of the fact that it adds more than 5 new major features ranging from the TYPO system to quick lambda functions and changes to the way references expressions work.

But now another new feature has been added - a feature that will benefit the TYPO engine considerably but has also been requested since the early days of the language development. The addition of these new types of lists has had considerable implications on the language itself too, fixed size lists are often faster to work with.

The syntax for writing one of these new lists, let's say of type string and one of type integer, each with five elements, would be:

YASS
$strings = [""] * 5
$ints = [0] * 5

TYPO is finally here in version 1.6.7 of ZPE. To be specific, TYPO has been in ZPE for a while but it's not been in use. Now ZPE is fully in support of TYPO. Take a look:

Variables can be declared (lines 8, 14, 17) using a type and then assigned with another value of that type (lines 11, 20). If you want to reuse the variable with a different type in it, you need to redeclare the variable (line 14). On top of that compilation errors are now thrown when a different type is assigned to a variable. Also, as seen on line 24, TYPO can evaluate internal methods for the return type and compare it to the type of the variable, hence why it will stop compiling at line 24.

This adds a bit more time to compilation, but helps in several ways:

  • From a learning/teaching perspective, TYPO encourages use of typing in programming
  • From a programmers view this is a good way to ensure that you are sticking to principles of programming

TYPO is by default turned off in all versions of ZPE but you can turn it on by changing the settings of the compiler. I recommend trying it out but do not suggest all programs written use typing! ZPE is primarily an untyped language and will likely always remain this way!

ZPE 1.6.6, the version which I never believed I'd ever finish working on, is now available for download. I don't often post the changelog straight onto my blog but here's a look at it:

-- Version 1.6.6 --

  • Fixed an issue with for loops
  • Added the circumflex syntax for power e.g. 5^2 is 25 (five squared) and 5^3 is 125
  • Added the variable mode to the -r ZAC. This mode is like single line mode except that variables and their values are persisted.
  • Removed the Program read mode and the Multi line read mode
  • Fixes with comments in the Zenith Parser
  • Fixed an issue in for loop with reading lists
  • Fixed an issue that caused negative numbers to convert to strings when parsed
  • Added binary parsing into the compiler e.g. $v = 0b0101. Binary values always start with a 0b
  • Added the to_decimal method to convert a string of binary, octal or hexadecimal characters to an integer
  • Command line arguments are now separated from program arguments using a -args command line
  • Added object inheritance
  • New if statement optional syntax using the THEN keyword: $x = 10 if $x == 11 then print("Yes") end if
  • Added the built-in object methods `inherit`, `serialise` and `get_definition`. Removed the general serialise and object_get_definition methods.
  • Fixed an issue where in the single line interpreter variable values were not actually retained properly
  • The single line interpreter no longer exits on an error but displays an error and continues.
  • Fixed an issue in which new ZPEObject would set their values and variables to the FRIENDLY only access
  • Added the optional 'code' parameter to the exit method
  • Small performance improvement with the LAMP parser
  • Added the cache_value and read_cache_value methods which read a value from a special secured file
  • Added the get_version method which obtains the version number of the ZPE instance it is running within
  • Added an option to disable methods from the runtime environment (using the properties file)
  • Added negation of variables such as -$v and improved the method of negative values being used
    Improved the way in which negative values are evaluated

It's quite extensive compared to other versions in terms of big features added. My favourite new feature is the improvement to the -r ZAC since it now uses the single line read mode but retains variable values between lines inlining it with interactive consoles in languages such as PHP. I also like the new power feature being a major part of the syntax and the new -args feature for the interpreter means that less time is spent figuring out what are ZPE command line arguments and what are program arguments making it run slightly faster (but also reducing the code base quite considerably). The to_decimal method is quite nice too, convert quickly between decimal and binary, octal and hex very quickly. Finally, I love the fact that it is now possible to quickly turn a positive value in a variable into a negative one with a simple - in front of the variable.

ZPE 1.6.6 will be the last version to use names from the Harry Potter universe, version 1.6.7 will be named Waverley after the railway station in Edinburgh and successive versions will take a similar approach being named after famous railway stations in Scotland.

ZPE 1.6.5 was a big update with lots of new features and bug fixes. The next version will bring even more interesting concepts to the my programming environment.

My favourite is the new Python style syntax. ZPE introduced way back in version 1.3.x the curly brace notation found in Java, C#, C and many more languages to allow function declarations to be created in a short hand way that follows the C style of doing this. Well, version 1.6.6 will now begin the introduction of Python colons to represent functions. I intend only to bring it to functions at present. I very much doubt this will be in version 1.6.6, but I'm looking to have it in version 1.7.x. But will the Python inspired syntax therefore encourage indentation? Probably not.

I'm also working on a ZPE to Python transpiler - this is because although it may not seem like it, Python has quite a similar syntax to ZPE (both languages share a bunch of syntaxes).

I will also be looking into a major restructure of the LAMP parser and looking to moving from it to a new parser I call Exparse which will parse all expressions regardless of being logical or mathematical.