 | Hi All
I am looking for pointers to starter information on building what is really an interpeter.
I have written a specialist 'language' for use in controlling PC flight simulators. It is very simple with only about 15 keywords. It does however have conditional statements (If.....then....else and case) and a form of looping. I am working on a two stage interpeter - similar to Java - first stage which is with the code editor does syntax checking and analyes the code turning it into a series of tokens and associated data. The second stage runs on the users computer and executes the tokens.
About 15 years ago I wrote something similar but no longer have the books I used to help me deveop it - also my recollections of how I did it have become very blurred, I think I am going about it rather ham-fistedly and would appreciate and pointers to where I can read up on basic compiler/interpreter principles. At the moment, for example, I cannot allow nesting as I have no clue as to how to handle that now. I'm not particularly worried about converting the intermediate code into machine code due to the nature of the target which is very specific. I am very interested in the approaches to parsing, syntax checking and analysing the source. I have recollections of using postfix notation and a stack last time but, as mentioned, it is all rather blurred....8-)
thanks in advance
Jon [Our usual advice is first to look at existing scripting languages such as python, Ruby, Lua, and TCL. There's rarely a compelling reason that you need to invent yet another scripting language, and it's a whole lot easier to hook your application to one that already works. -John]
|
|