I quickly wrote an interpreter for some sort of experimental programing language i came up with, in PHP (yes, in PHP). The language itself doesn't have anything really special, I just wanted to give it a try.
I got the basic things working (Hello World, input to output, string manipulation, arithmetics) but I'm getting stuck with the management of blocks and grouped statements.
What I mean is: PHP and most other languages let you do this: ((2+2)*(8+2)+2)
, of course not only with mathematical computations.
My program structure currently consists of a multidimensional array built like this:
ID => Type (Identifier, String, Int, Newline, EOF, Comma, ...)
Contents (If identifier, int or string)
- How could I allow statements to be executed in a defined order like in the PHP example above?