public ProgramState execute(ProgramState state) { int val = expr.evaluate(state.SymbolTable); state.SymbolTable.setValue(id, val); return(state); }
public ProgramState execute(ProgramState state) { int val = expr.evaluate(state.SymbolTable); state.Output.add(val); return(state); }
public int evaluate() { int l = left.evaluate(); if (op != null) { int r = right.evaluate(); return(op is Plus ? l + r : l - r); } return(l); }
public ProgramState execute(ProgramState state) { int val = expr.evaluate(state.SymbolTable); if (val != 0) { state.Stack.add(thenStmt); } else { state.Stack.add(elseStmt); } return(state); }
public ProgramState execute(ProgramState state) { int val = id.evaluate(state.SymbolTable); if (state.FileTab.exists(val)) { StreamReader b = state.FileTab.getValue(val); b.Close(); state.FileTab.delete(val); } else { throw new FileNotFoundException("File not found!"); } return(state); }
public int evaluate() { return(e.evaluate()); }