Tiny Basic Interpreter...

 
class TBinterpreter {
  ...

  boolean statement() {
    int temp, test;
    nexToken = '\0';
    switch (Code.getCommand()) {
    ...
    case cm_if:
      if (!expression()) {
        error("We need a value");
        return false;}
      test = 0;
      if (nexToken == '<') test--;
      else if (nexToken == '>') test++;
      else if (nexToken != '=') {
        error("Compare expected");
        return false;}
      nexToken = Code.getChar();
      if (!expression()) {
        error("We need 2nd value");
        return false;}
      if (Code.getCommand() != cm_then) {
        error("Missing 'THEN'");
        return false;}
      temp = Stak.pop();
      if (test==0) {
        if (Stak.pop()==temp)
          return statement();}
      else if (test<0) {
        if (Stak.pop()<temp)
          return statement();}
      else if (Stak.pop()>temp)
        return statement();
      return true; // ignore rest of line
      break;
    ...} // switch
    return true;} // statement