Reviving the EXPLOR programming language
By: Emilian Branzelov
Tags: Graphics, Language, Parsing, Cpp17, C Programming

A pattern row is defined by a single 12 digit octal number meaning every digit is 3 bits, resulting in 36 values. If we have larger than 12 digits in a definition they carry over to the next row. Subsequent PAT instructions get added to the last named pattern so we don’t have to repeat the label for every row ( you can see that in the example above ). One thing to note here is that we keep leading zeroes when converting to binary.

But why only static patterns ? Introducing the SVP instruction, a way to grab a portion of the image array and convert it to a named pattern. This instruction does now wrap and its converted to black and white values according to the current WBT settings.

SVP definition

Starting from the point (x, y) in the image array we select a rectangle with the defined width and height and give it a name. Here goto is separated with a comma because we cant know where height ends and the goto label begins.

Flow Control

Here we have some exceptions on how goto is handled, for IF and GOTO it is mandatory to specify it. The instructions for GOTO and IF are just transfer of control where IF is conditional and its argument pred is one of the following operators GT ( greater than ) , EQ ( equal ) and LT ( less than ). Parameters for the IF instruction can be a variable or just a fixed number.

The instruction DO acts kind of like a coroutine, so it executes the instruction named in the parameters and usually terminates with a special GOTO (1,1)DONE that is intended to return the control back to its original execution point.

Examples: IF (1,1)(SIZE,GT,17)ITER → this will test if the SIZE variable is greater than 17 and go to the instruction with label ITER, otherwise it just continues to the next instruction in the program.

The meta part of the language

Instruction modification

If all the the concepts so far didn’t introduce enough randomness and variety, you have 3 more instructions for giving your program another layer of control.

CHV is a shorthand for CHange Value, but with a twist. The parameter param denotes the variable name we want to modify, and operation cant be any of the following [SET,ADD,SUB,MPY,DIV] corresponding to [=,+,-,*,/]. But wait there are two values val1 and val2 which one are we going to use ?

Well val2 is optional, but has to be specified ( altho redundant ) if we want to use the goto statement. If we have no val2, we just use val1 to compute the new value otherwise we pick a random number in the range [val1,val2] that we use for the computation. Because it might not be really clear lets show a couple of examples.

Example: CHV (1,1)SIZE,ADD,5,15 -> this will be interpreted as something like SIZE += rand(5,15), but if we had CHV (1,1)SIZE,ADD,5 it would have been SIZE += 5

The next instruction CHP stands for CHange Pattern, its only used to replace what named pattern a BXL,BAXL or BPXL instruction uses, so something like CHP (1,1)LINE9,PAT3 will change the named pattern used in the instruction with label LINE9 with PAT3. Really specific to the aforementioned instructions but useful.

And now the last instruction of the language but maybe the most powerful one is for modifying already defined instructions using the same techniques that we use to modify the image array.

XLI needs a label of a already defined instruction, a parameter called part that specifies what argument we want to modify and a standard transliteration with a probability q(xlit).

part can be any of the following values:

NUMS → the numbers argument of a AXL or BAXL

→ the numbers argument of a AXL or BAXL DIRS , DIR → the direction(s) of AXL,BAXL,PXL or BPXL

, → the direction(s) of AXL,BAXL,PXL or BPXL CHST →the characters in AXL or BAXL

→the characters in AXL or BAXL XLIT → the transliteration (xlit) of XL,AXL,BXL or BAXL

→ the transliteration (xlit) of XL,AXL,BXL or BAXL WBTS → the character strings in a WBT instruction

→ the character strings in a WBT instruction TPLS →the translation triples of PXL or BPXL

Example: XLI (1,1)LINE5,DIRS,1(NR,RE) → replace the directions of the instruction at the label LINE5 where all North becomes Right and Right becomes East