Jamie Balfour

Welcome to my personal website.

Find out more about me, my personal projects, reviews, courses and much more here.

ZPE 1.4.3 - the biggest change in ZPE history [updated]

Version 1.4.2HA is the current alpha version of the next ZPE and it's the biggest change to ZPE in the history of ZPE, a lot of code written in version 1.3.x has been replaced with much more efficient code, particularly with the evaluation of conditions and maths.

Real Math Mode was added in version 1.3.5.60 but it was always up for evaluation. The compiler side of it was written in a way that allowed the compiler to 'peek' at several symbols ahead of the current symbol in the traversal. Brackets were considered mathematical, so if a mathematical symbol wasn't found, ZPE would assume since seeing brackets that it was a mathematical expression. That meant that logical expressions were never considered on this expression. 

Now in ZPE 1.4.3 (which I will hopefully release soon) mathematical and logical expressions are compiled to the singular "EXPRESSION" token and then, at runtime are evaluated to a mathematical expression or a logical expression based on the first token found. 

E.g. 

+

55          33

Would make the interpreter realise this is mathematical, not logical. With the following it would also realise that this is logical:

&&

true        false

And this is because it sees an AND token (&&). 

What about brackets though? Well, the interpreter will skip through brackets going right down to the base and do exactly the same with that. Easy.

This makes the compiler also more efficient and certainly more reliable.

I have just recently finished the compiler side and the interpreter side was easy enough to modify for the new system. 

Much of what made ZPE the way it was back in the day has been replaced with a fresh system that does less work, has lead to much fewer traversals and makes far more sense. Logic is evaluated in the exact same way as mathematical expressions. By doing this, the system follows the orders of precedence where AND will always be evaluated before OR. 

As a result of the change, the factorial problem as I know it as currently, has been fixed, so $z = (factorial($n + $r - 1)) / (factorial($r) * factorial($n - 1)) now works without the 0 + at the beginning of the first brackets.

This update also eliminated the need for the compiler to peek at the next bunch of symbols until it found a terminator or a mathematical or logical symbol. 

Update 1.4.3 has since been released and trialled. I'd like to thank Merlin for pointing out a few bugs within the new LAMP interpreter.

Version 1.4.3 changes what was described above and assess the expressions in the compiler to mathematical or logical, thus removing this from the interpreter. The system still works the same.

Version 1.4.3 drops support for XOR in a statement since it was far too complicated to parse correctly, but it does re-add the xor command. A lot of what was done in the interpreter has been shifted to the compiler, allowing the compiler to compile more efficient programs and to reduce execution time on the interpreter side of things, which as a result means that while loops and for loops will interpret faster. 

I'm hoping to make several more compiler-based improvements that will make small yet noticeable differences for the interpreter.

I genuinely believe that version 1.4.3 is the first version where the core is actually finished in both the interpreter and compiler.

Posted in Programming
zpe
1.4.3
latest
july
1.4.2HA
Comments
Powered by DASH 2.0