Need help to write an interpreter in Java
I need your help to develop an interpreter with given specs below. Can you guide me how start with this? I'm not that good in Java and our instructor requires us to to do this java. Do you think this is possible in Java? My deadline will be next week...till now im not able to figure out how will i do coding for this. ..:(
Input should look like this:
FLOAT x is 0.00
STRING str is $Hello World$
FLOAT y is 0.00
FLOAT res is 0.00
DISPLAY $ The sum is :$
GIVEMORE ADD x y
The out put should be
/* assuming x = 10 and y = 0 */
The sum is 10
Re: Need help to write an interpreter in Java
I don't see that the example is complete/correct. Where does the code do anything with str?
One step would be to define the syntax of the language, the types of statements and the data types.
Then write a parser that reads the source, parses and executes each statement.