I have no idea how to start the interpreter for this java project.
I need some hint on the LET statement in order to write other code such as ADD, MINUS, GOTO...etc
Thanks
public abstract class Statement
{
// execute() takes a ProgramState and executes this statement, by making
// any necessary changes to the ProgramState (e.g. a new value for the
// program counter, changing the value of some variable, pushing or
// popping from the line number stack).
//
// In the event that the execution of the statement causes a fatal error
// that should terminate the Facile program, such as division by zero or
// a RETURN statement without a corresponding GOSUB, a FatalException is
// thrown.
public abstract void execute(ProgramState state)
throws FatalException;
}
public class LetStatement extends Statement
{
private char variableName;
private int value;
public LetStatement(char variableName, int value)
{
this.variableName = variableName;
this.value = value;
}
// The LetStatement version of execute() should make two changes to the
// state of the program:
//
// * set the value of the appropriate variable
// * increment the program counter
//
// There is no way for a LET statement to fail, so there is no reason for
// it to ever throw a FatalException. Nevertheless, the signature of the
// method must match the signature of the execute() method in Statement,
// so we'll leave the "throws" clause alone.
This part is where i need help
public void execute(ProgramState state)
throws FatalException
{
}
}