Dear friends, hello!
Not long ago I became interested in the topic of industrial automation, but the topic is deep and complex, CODESYS alone is worth it, the tasks are not that difficult, certainly not commensurate with the difficulties that were expected when diving into this area.
The conclusion I came to is simple, I just need an interpreter built into my hardware, since tasks change every day, I would like to just take the script and upload it to a flash drive, then insert it into the hardware and make it work...
After searching, I found a bunch of basic similar interpreters, but somehow it’s not at all close to me, and I was looking for something similar to PHP, since web programming is much more my area than what I have to do now.
In short, after searching, I found this on github:
The interpreter is perfect for all tasks, except for one thing, there is no way to create custom functions, otherwise it is simply excellent!
I ask for help from experts, please help me integrate the ability to create custom functions.
Sample code:
//Условия
$sammer[1] = "tree"; if($sammer[1] == "treex"){ pre("hello"); } if($sammer[1] == "tree"){ print("hello world");}
//Массивы
$sammer[1] = 13; $sammer[2] = "hello world"; print($sammer[2]); print($sammer[1]);
//Циклы
$i = 0; while($i < 10){$i = $i+1; pre($i); }
By the way, the compile() function converts this string
$sammer[1] = "tree"; if($sammer[1] == "treex"){ pre("hello"); } if($sammer[1] == "tree"){ print("hello world");}
Here’s a line with a set of commands that is understandable to the interpreter:
"tree"SV0000GV0000"treex"_A=IF#G0017"hello"_PRGV0000"tree"A=IF#G002a"hello world"_PR