To set or not to set in PPL?

The PPL preprocessor converts scr-code to intermediate ppl-representation for immeadiate execution.
Format of statement for preprocessor is no different from normal:
operator <body><end symbol>
For example: var x = value;
Here: operator: var
body: x = 0
end symbol: ;

The set operator is a special case, this operator is used much more often than others, and in many programming languages it is implied but not written. Early versions of the PPL language required the mandatory inclusion of the set operator in the program code, its absence caused errors, so I decided to get rid of the set, that is, instead of
set x = 0;
to write
x = 0;
This process is carried out as follows:
The PPL preprocessor scans the code from left to right to “=” and inserts operators set or setkvp (set key value pair) in the appropriate places according to the following rules:
Symbol “=” appears in the following 2 groups of statements:

  1. Conditional expressions:

==, <=, >=, !=

  1. PPL operators: set, setkvp, array, sinit, ssetrow, sset,var,const, realloc.

Format of these operators is given below:

set name = value;
setkvp name = key,value;
array name[length]  = init_value   
array name[]  = { elem1,elem2,elemN…};
sinit name = init_value;   
ssetrow name [ind1,ind2,indN…] =  {elem1,elem2,elemN…};
sset name = init_value;   
var name = value;
const name = value;
realloc array_name[ new_length] = init_value;

When symbol "= " is found, it checks whether it is an element of the first group, if yes, the search continues.
If not, it scans from right to left to the first end symbol (or to the beginning of the code) and this position is considered the beginning of the statement.
In this case, end symbol is a end symbol of both a simple sentence and a block one and has the following meanings: ; space tab { } ).

Samples of block sentences:

function foo()
     x = 0;
for(I,0,5)    x = 0;
for(I,0,5) {  x = 0;}

If the found statement does not contain operators
"array", "sinit", "ssetrow", "sset" "var", "const", "realloc",
then the body of the sentence is checked and, in accordance with the format, the operator set or setkvp is inserted at the beginning of it.
It should be added that during the scanning process, comments are skipped, as well as fragments of text enclosed in quotes.

The latest PPL version v.2.0.2 (Tutorial, Programs, Samples) is available here: GitHub - okogosov/PPL: Parenthesis Programming Language (PPL)

Thanks for sharing you work.

The linked GitHub repo is a collection of zip files - is there a source repository available?
(GitHub won’t let me inspect the contents of zip files)


Hi Stephen,
Thank you for interest to my project.
1.Github does not display contents because is big enough? but you may download it and open. Github checks viruses in zip-files.
2. Read TutorialPPL.pdf with numerous samples.
3. PPL is the giant project and I uploaded to Github only several its sources. About set-detection I will create today source for test AddSet.project and you will may learn it.
4. I am interested to promote PPL and want to develop Smart Editor for it, if you want to join to this developing - I will be very glad. As well if you have any ideas to add to PPL - you welcome.

Hi Stephen, GitHub - okogosov/PPL: Parenthesis Programming Language (PPL)\okogosov\ppl.


1 Like