I am trying to understand how a language interpreter works. Can you guys point me the general lines on how an interpreter works?
I mean, suppose I have some lines written like this
10 x = 200;
20 for r = x to 1000 step 1
25 z = r + 32;
30 print z;
40 next r;
50 end;
what's the best way to build an interpreter that could run something like that?
Having a large matrix containing all functions allowed and searching for a match? The first line, for example: it is assigning 200 to a variable x, but these are symbols that does not exist.
If you guys can give me the direction...
Thanks for any help.
Compiler creation is a complex topic (an interpreter can be seen as a special compiler).
You have to first parse it - try to understand the syntax and then create some internal representation (abstract syntax tree) and then create some execution logic.
Wikpedia suggests http://mcs.une.edu.au/~comp319/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With