Two stages, one program
The transpiler tracks nested blocks through a context stack and emits structured instructions. The execution layer dispatches those instructions, maintaining variable values and declared types.
Language features
The supplied implementation supports integer and string variables, input, output, addition, while loops, if statements and a rand() function returning zero or one. Output supports variable interpolation using ${name}.
The grid example
The program below reads two dimensions and assembles a text grid using nested loops and string concatenation. The literal \n sequences remain part of the source and are handled by the output implementation.
Explore the implementation
git clone https://github.com/SAED2906/ExJSON.gitCode example
int x = 0
int y = 0
in(x)
in(y)
String grid = ""
int counterx = 0
int countery = 0
int linewidthcounter = 0
while (countery < y) {
linewidthcounter = 0
while (linewidthcounter <= x) {
grid = grid + "__"
linewidthcounter = linewidthcounter + 1
}
grid = grid + "\n"
while (counterx < x) {
grid = grid + " |"
counterx = counterx + 1
}
grid = grid + "\n"
countery = countery + 1
counterx = 0
}
linewidthcounter = 0
while (linewidthcounter <= x) {
grid = grid + "__"
linewidthcounter = linewidthcounter + 1
}
print(${grid})