Question: Language Interpreter JAVA Problem Description: The goal of this exercise is to reproduce in a limited way, an interpreter for a computer language. The language

Language Interpreter

JAVA

Problem Description: The goal of this exercise is to reproduce in a limited way, an interpreter for a computer language. The language will be defined as the following:

a. Declaration statements (integer or string only, single-letter names)

b. Character-string literals (Ex: Jim Scandale)

c. Simple numeric assignments (Ex: a = b + c, =, , *, /, %)

Simple character-string assignments (Ex: n = CSE116 )

d. Read (input one integer value)

e. Display (output integer value or output character-string value)

f. End-statement (end signals the end of the program)

The program will be typed by the user, a single statement on each line. The interpreter will read the program in this language and store it onto a text file. Variables will be checked against their declaration statements and each use of an undeclared variable will be flagged as an error. When the end statement is reached and stored, the interpreter will check to see if there were any errors flagged. If none, it will begin executing the statements a line at a time. If there were errors, the interpreter will display a summary error message (ex: too many errors execution deleted) and go back to reading user input.

The execution phase will

a. Display each statement exactly as supplied by the user.

b. Create an internal variable for each declaration statement

c. Manipulate values as dictated by the program

d. Perform read and display statements

e. When execution reaches the end statement, stop!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!