/* Generated By:JavaCC: Do not edit this line. ValParser.java */
package it.univaq.disim.sealab.ttep.val;

public class ValParser implements ValParserConstants {
  public static void main(String args []) throws ParseException
  {
    ValParser parser;
                if (args.length == 1) {
      System.out.println("Val Parser Version 1.0:  Reading from file " + args[0] + " . . .");
      try {
        parser = new ValParser(new java.io.FileInputStream(args[0]));
      }
      catch (java.io.FileNotFoundException e) {
        System.out.println("Val Parser Version 1.0:  File " + args[0] + " not found.");
        return;
      }
    }
    else {
      System.out.println("Val Parser Version 1.0:  Usage is one of:");
      System.out.println("         java ValParser < inputfile");
      System.out.println("OR");
      System.out.println("         java ValParser inputfile");
      return;
    }
    try {
      parser.ValSpec();
      System.out.println("Val Parser Version 1.0:  Ruby program parsed successfully.");
    }
    catch (ParseException e) {
      System.out.println(e.getMessage());
      System.out.println("Val Parser Version 1.0:  Encountered errors during parse.");
    }

  }

  final public specificheAEmilia.IdentExpr IdentExpr() throws ParseException {
        specificheAEmilia.IdentExpr ris;
        Token t;
    t = jj_consume_token(T_ID);
                ris = new specificheAEmilia.IdentExpr(t.image);
                {if (true) return ris;}
    throw new Error("Missing return statement in function");
  }

  final public specificheAEmilia.Expression Erecord() throws ParseException {
        specificheAEmilia.Expression ris;
        java.util.List<specificheAEmilia.Expression> list = new java.util.ArrayList<specificheAEmilia.Expression>();
        specificheAEmilia.Expression expression;
        specificheAEmilia.IdentExpr identExpr;
        Token t1;
        Token t2;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case T_RECORD_CONS:
      jj_consume_token(T_RECORD_CONS);
      jj_consume_token(LPAREN);
      expression = E();
                                                   list.add(expression);
      label_1:
      while (true) {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case COMMA:
          ;
          break;
        default:
          jj_la1[0] = jj_gen;
          break label_1;
        }
        jj_consume_token(COMMA);
        expression = E();
                                                                                                     list.add(expression);
      }
      jj_consume_token(RPAREN);
                specificheAEmilia.Expression[] expressions = new specificheAEmilia.Expression[list.size()];
                for (int i = 0; i < list.size(); i++)
                        {
                        specificheAEmilia.Expression exp1 = list.get(i);
                        expressions[i] = exp1;
                        }
                specificheAEmilia.RecordCons recordCons = new specificheAEmilia.RecordCons(expressions);
                ris = recordCons;
                {if (true) return ris;}
      break;
    case T_PUT:
      jj_consume_token(T_PUT);
      jj_consume_token(LPAREN);
      t1 = jj_consume_token(T_ID);
      jj_consume_token(COMMA);
      expression = E();
      jj_consume_token(COMMA);
      identExpr = IdentExpr();
      jj_consume_token(RPAREN);
                specificheAEmilia.Put put = new specificheAEmilia.Put(t1.image,expression,identExpr);
                ris = put;
                {if (true) return ris;}
      break;
    default:
      jj_la1[1] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

  final public specificheAEmilia.Expression Earr() throws ParseException {
        java.util.List<specificheAEmilia.Expression> list = new java.util.ArrayList<specificheAEmilia.Expression>();
        specificheAEmilia.Expression expression;
        specificheAEmilia.Expression expression2;
        specificheAEmilia.IdentExpr identExpr;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case T_ARRAY_CONS:
      jj_consume_token(T_ARRAY_CONS);
      jj_consume_token(LPAREN);
      expression = E();
                                                  list.add(expression);
      label_2:
      while (true) {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case COMMA:
          ;
          break;
        default:
          jj_la1[2] = jj_gen;
          break label_2;
        }
        jj_consume_token(COMMA);
        expression = E();
                                                                                                    list.add(expression);
      }
      jj_consume_token(RPAREN);
                specificheAEmilia.Expression[] expressions = new specificheAEmilia.Expression[list.size()];
                for (int i = 0; i < list.size(); i++)
                        {
                        specificheAEmilia.Expression exp1 = list.get(i);
                        expressions[i] = exp1;
                        }
                specificheAEmilia.ArrayCons arrayCons = new specificheAEmilia.ArrayCons(expressions);
                {if (true) return arrayCons;}
      break;
    case T_WRITE:
      jj_consume_token(T_WRITE);
      jj_consume_token(LPAREN);
      expression = E();
      jj_consume_token(COMMA);
      expression2 = E();
      jj_consume_token(COMMA);
      identExpr = IdentExpr();
      jj_consume_token(RPAREN);
                specificheAEmilia.Write write = new specificheAEmilia.Write(expression,expression2,identExpr);
                {if (true) return write;}
      break;
    default:
      jj_la1[3] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

  final public specificheAEmilia.Expression El() throws ParseException {
        specificheAEmilia.Expression expression;
        java.util.List<specificheAEmilia.Expression> list = new java.util.ArrayList<specificheAEmilia.Expression>();
        Token t1;
        specificheAEmilia.IdentExpr identExpr;
        Token t2;
        specificheAEmilia.IdentExpr identExpr2;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case T_LIST_CONS:
      jj_consume_token(T_LIST_CONS);
      jj_consume_token(LPAREN);
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case LPAREN:
      case T_GET:
      case T_READ:
      case T_FIRST:
      case T_TRUE:
      case T_FALSE:
      case T_LENGTH:
      case T_LIST_CONS:
      case T_TAIL:
      case T_CONCAT:
      case T_INSERT:
      case T_REMOVE:
      case T_ARRAY_CONS:
      case T_WRITE:
      case T_RECORD_CONS:
      case T_PUT:
      case T_ID:
      case T_NUMBER:
      case 60:
        expression = E();
                                                  list.add(expression);
        label_3:
        while (true) {
          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
          case COMMA:
            ;
            break;
          default:
            jj_la1[4] = jj_gen;
            break label_3;
          }
          jj_consume_token(COMMA);
          expression = E();
                                                                                                     list.add(expression);
        }
        break;
      default:
        jj_la1[5] = jj_gen;
        ;
      }
      jj_consume_token(RPAREN);
                specificheAEmilia.Expression[] expressions = new specificheAEmilia.Expression[list.size()];
                for (int i = 0; i < list.size(); i++)
                        {
                        specificheAEmilia.Expression exp1 = list.get(i);
                        expressions[i] = exp1;
                        }
                specificheAEmilia.ListCons listCons = new specificheAEmilia.ListCons(expressions);
                {if (true) return listCons;}
      break;
    case T_TAIL:
      jj_consume_token(T_TAIL);
      jj_consume_token(LPAREN);
      identExpr = IdentExpr();
      jj_consume_token(RPAREN);
                specificheAEmilia.Tail tail = new specificheAEmilia.Tail(identExpr);
                {if (true) return tail;}
      break;
    case T_CONCAT:
      jj_consume_token(T_CONCAT);
      jj_consume_token(LPAREN);
      identExpr = IdentExpr();
      jj_consume_token(COMMA);
      identExpr2 = IdentExpr();
      jj_consume_token(RPAREN);
                specificheAEmilia.Concat concat = new specificheAEmilia.Concat(identExpr,identExpr2);
                {if (true) return concat;}
      break;
    case T_INSERT:
      jj_consume_token(T_INSERT);
      jj_consume_token(LPAREN);
      expression = E();
      jj_consume_token(COMMA);
      identExpr = IdentExpr();
      jj_consume_token(RPAREN);
                specificheAEmilia.Insert insert = new specificheAEmilia.Insert(expression,identExpr);
                {if (true) return insert;}
      break;
    case T_REMOVE:
      jj_consume_token(T_REMOVE);
      jj_consume_token(LPAREN);
      expression = E();
      jj_consume_token(COMMA);
      identExpr = IdentExpr();
      jj_consume_token(RPAREN);
                specificheAEmilia.Remove remove = new specificheAEmilia.Remove(expression,identExpr);
                {if (true) return remove;}
      break;
    default:
      jj_la1[6] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

  final public specificheAEmilia.Expression Eatf() throws ParseException {
        specificheAEmilia.Expression ris;
        Token t1;
        specificheAEmilia.IdentExpr identExpr;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case LPAREN:
      jj_consume_token(LPAREN);
      ris = E();
      jj_consume_token(RPAREN);
                {if (true) return ris;}
      break;
    case T_ID:
      ris = IdentExpr();
                {if (true) return ris;}
      break;
    case T_NUMBER:
      t1 = jj_consume_token(T_NUMBER);
                java.text.NumberFormat numberFormat = java.text.NumberFormat.getNumberInstance();
                try
                        {
                        Number number = null;
                        try {
                                number = numberFormat.parse(t1.image);
                                }
                        catch (java.text.ParseException e)
                                {
                                {if (true) throw new ParseException(e.getMessage());}
                                }
                        if (number instanceof java.lang.Long)
                                {
                                java.lang.Long long1 = (java.lang.Long)number;
                                specificheAEmilia.Integer integer1 = new specificheAEmilia.Integer(long1.intValue());
                                {if (true) return integer1;}
                                }
                        if (number instanceof java.lang.Double)
                                {
                                java.lang.Double double1 = (java.lang.Double)number;
                                specificheAEmilia.Real real = new specificheAEmilia.Real(double1);
                                {if (true) return real;}
                                }
                        }
                catch (ParseException parseException)
                        {
                        {if (true) return null;}
                        }
      break;
    case T_LENGTH:
      jj_consume_token(T_LENGTH);
      jj_consume_token(LPAREN);
      identExpr = IdentExpr();
      jj_consume_token(RPAREN);
                specificheAEmilia.Length length = new specificheAEmilia.Length(identExpr);
                {if (true) return length;}
      break;
    default:
      jj_la1[7] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

  final public specificheAEmilia.Expression Eat() throws ParseException {
        specificheAEmilia.Expression e1;
        specificheAEmilia.Expression e2;
        java.util.List<specificheAEmilia.Expression> list = new java.util.ArrayList<specificheAEmilia.Expression>();
    e1 = Eatf();
                list.add(e1);
    label_4:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 54:
      case 55:
        ;
        break;
      default:
        jj_la1[8] = jj_gen;
        break label_4;
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 54:
        jj_consume_token(54);
        e2 = Eatf();
                specificheAEmilia.Expression exp1 = list.get(list.size() - 1);
                specificheAEmilia.Moltiplicazione moltiplicazione = new specificheAEmilia.Moltiplicazione(exp1,e2);
                list.add(moltiplicazione);
        break;
      case 55:
        jj_consume_token(55);
        e2 = Eatf();
                specificheAEmilia.Expression exp2 = list.get(list.size() - 1);
                specificheAEmilia.Divisione divisione = new specificheAEmilia.Divisione(exp2,e2);
                list.add(divisione);
        break;
      default:
        jj_la1[9] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
                specificheAEmilia.Expression exp3 = list.get(list.size() - 1);
                {if (true) return exp3;}
    throw new Error("Missing return statement in function");
  }

  final public specificheAEmilia.Expression Ea() throws ParseException {
        specificheAEmilia.Expression e1;
        specificheAEmilia.Expression e2;
        java.util.List<specificheAEmilia.Expression> list = new java.util.ArrayList<specificheAEmilia.Expression>();
    e1 = Eat();
                list.add(e1);
    label_5:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case DASH:
      case 56:
        ;
        break;
      default:
        jj_la1[10] = jj_gen;
        break label_5;
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 56:
        jj_consume_token(56);
        e2 = Eat();
                specificheAEmilia.Expression exp1 = list.get(list.size() - 1);
                specificheAEmilia.Somma somma = new specificheAEmilia.Somma(exp1,e2);
                list.add(somma);
        break;
      case DASH:
        jj_consume_token(DASH);
        e2 = Eat();
                specificheAEmilia.Expression exp2 = list.get(list.size() - 1);
                specificheAEmilia.Sottrazione sottrazione = new specificheAEmilia.Sottrazione(exp2,e2);
                list.add(sottrazione);
        break;
      default:
        jj_la1[11] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
                specificheAEmilia.Expression exp3 = list.get(list.size() - 1);
                {if (true) return exp3;}
    throw new Error("Missing return statement in function");
  }

  final public specificheAEmilia.Expression Ebt() throws ParseException {
        specificheAEmilia.Expression e1;
        specificheAEmilia.Expression e2;
        Token t1;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case T_TRUE:
      t1 = jj_consume_token(T_TRUE);
                specificheAEmilia.Boolean b1 = new specificheAEmilia.Boolean(true);
                {if (true) return b1;}
      break;
    case T_FALSE:
      t1 = jj_consume_token(T_FALSE);
                specificheAEmilia.Boolean b2 = new specificheAEmilia.Boolean(false);
                {if (true) return b2;}
      break;
    default:
      jj_la1[12] = jj_gen;
      if (jj_2_1(3)) {
        e1 = Ea();
        jj_consume_token(57);
        e2 = Ea();
                specificheAEmilia.Minore minore = new specificheAEmilia.Minore(e1,e2);
                {if (true) return minore;}
      } else if (jj_2_2(3)) {
        e1 = Ea();
        jj_consume_token(LE);
        e2 = Ea();
                specificheAEmilia.MinoreUguale minoreUguale = new specificheAEmilia.MinoreUguale(e1,e2);
                {if (true) return minoreUguale;}
      } else if (jj_2_3(3)) {
        e1 = Ea();
        jj_consume_token(58);
        e2 = Ea();
                specificheAEmilia.Maggiore maggiore = new specificheAEmilia.Maggiore(e1,e2);
                {if (true) return maggiore;}
      } else if (jj_2_4(3)) {
        e1 = Ea();
        jj_consume_token(GE);
        e2 = Ea();
                specificheAEmilia.MaggioreUguale maggioreUguale = new specificheAEmilia.MaggioreUguale(e1,e2);
                {if (true) return maggioreUguale;}
      } else if (jj_2_5(3)) {
        e1 = Ea();
        jj_consume_token(59);
        e2 = Ea();
                specificheAEmilia.Equal equal = new specificheAEmilia.Equal(e1,e2);
                {if (true) return equal;}
      } else if (jj_2_6(3)) {
        e1 = Ea();
        jj_consume_token(NE);
        e2 = Ea();
                specificheAEmilia.Different different = new specificheAEmilia.Different(e1,e2);
                {if (true) return different;}
      } else {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case LPAREN:
          jj_consume_token(LPAREN);
          e1 = Eb();
          jj_consume_token(RPAREN);
                {if (true) return e1;}
          break;
        case 60:
          jj_consume_token(60);
          e1 = Ebt();
                {if (true) return e1;}
          break;
        default:
          jj_la1[13] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
      }
    }
    throw new Error("Missing return statement in function");
  }

  final public specificheAEmilia.Expression Eb() throws ParseException {
        specificheAEmilia.Expression e1;
        specificheAEmilia.Expression e2;
        java.util.List<specificheAEmilia.Expression> list = new java.util.ArrayList<specificheAEmilia.Expression>();
    e1 = Ebt();
                list.add(e1);
    label_6:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case AND:
      case OR:
        ;
        break;
      default:
        jj_la1[14] = jj_gen;
        break label_6;
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case AND:
        jj_consume_token(AND);
        e2 = Ebt();
                specificheAEmilia.Expression exp1 = list.get(list.size() - 1);
                specificheAEmilia.And and = new specificheAEmilia.And(exp1,e2);
                list.add(and);
        break;
      case OR:
        jj_consume_token(OR);
        e2 = Ebt();
                specificheAEmilia.Expression exp2 = list.get(list.size() - 1);
                specificheAEmilia.Or or = new specificheAEmilia.Or(exp2,e2);
                list.add(or);
        break;
      default:
        jj_la1[15] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
                specificheAEmilia.Expression exp3 = list.get(list.size() - 1);
                {if (true) return exp3;}
    throw new Error("Missing return statement in function");
  }

  final public specificheAEmilia.Expression E() throws ParseException {
        specificheAEmilia.Expression ris;
        specificheAEmilia.Expression expression;
        specificheAEmilia.IdentExpr identExpr;
        Token t1;
        Token t2;
    if (jj_2_7(3)) {
      ris = Eb();
                {if (true) return ris;}
    } else if (jj_2_8(3)) {
      ris = Ea();
                {if (true) return ris;}
    } else {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case T_LIST_CONS:
      case T_TAIL:
      case T_CONCAT:
      case T_INSERT:
      case T_REMOVE:
        ris = El();
                {if (true) return ris;}
        break;
      case T_ARRAY_CONS:
      case T_WRITE:
        ris = Earr();
                {if (true) return ris;}
        break;
      case T_RECORD_CONS:
      case T_PUT:
        ris = Erecord();
                {if (true) return ris;}
        break;
      case T_FIRST:
        jj_consume_token(T_FIRST);
        jj_consume_token(LPAREN);
        identExpr = IdentExpr();
        jj_consume_token(RPAREN);
                ris = new specificheAEmilia.First(identExpr);
                {if (true) return ris;}
        break;
      case T_READ:
        jj_consume_token(T_READ);
        jj_consume_token(LPAREN);
        expression = E();
        jj_consume_token(COMMA);
        identExpr = IdentExpr();
        jj_consume_token(RPAREN);
                ris = new specificheAEmilia.Read(expression,identExpr);
                {if (true) return ris;}
        break;
      case T_GET:
        jj_consume_token(T_GET);
        jj_consume_token(LPAREN);
        t1 = jj_consume_token(T_ID);
        jj_consume_token(COMMA);
        identExpr = IdentExpr();
        jj_consume_token(RPAREN);
                ris = new specificheAEmilia.Get(t1.image,identExpr);
                {if (true) return ris;}
        break;
      default:
        jj_la1[16] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
    throw new Error("Missing return statement in function");
  }

  final public it.univaq.disim.sealab.ttep.val.classes.MeasureValue MeasureValue() throws ParseException {
        Token t1;
        specificheAEmilia.Expression e1 = null;
        Token t2;
    jj_consume_token(DASH);
    jj_consume_token(T_VALUE_M);
    jj_consume_token(T_OF);
    jj_consume_token(T_MEASURE);
    jj_consume_token(APEX);
    t1 = jj_consume_token(T_ID);
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case LBRACKET:
      jj_consume_token(LBRACKET);
      e1 = E();
      jj_consume_token(RBRACKET);
      break;
    default:
      jj_la1[17] = jj_gen;
      ;
    }
    jj_consume_token(APEX);
    jj_consume_token(COLON);
    t2 = jj_consume_token(T_NUMBER);
                Float f1 = new Float(t2.image);
                it.univaq.disim.sealab.ttep.val.classes.MeasureValue measureValue = new it.univaq.disim.sealab.ttep.val.classes.MeasureValue(t1.image,e1,f1);
                {if (true) return measureValue;}
    throw new Error("Missing return statement in function");
  }

  final public it.univaq.disim.sealab.ttep.val.classes.ValSpec ValSpec() throws ParseException {
        java.util.List<it.univaq.disim.sealab.ttep.val.classes.MeasureValue> list = new java.util.ArrayList<it.univaq.disim.sealab.ttep.val.classes.MeasureValue>();
        it.univaq.disim.sealab.ttep.val.classes.MeasureValue mv;
    jj_consume_token(T_STATIONARY);
    jj_consume_token(T_VALUE);
    jj_consume_token(T_OF);
    jj_consume_token(T_THE);
    jj_consume_token(T_PERFORMANCE);
    jj_consume_token(T_MEASURES);
    jj_consume_token(T_FOR);
    jj_consume_token(T_ID);
    jj_consume_token(COLON);
    label_7:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case DASH:
        ;
        break;
      default:
        jj_la1[18] = jj_gen;
        break label_7;
      }
      mv = MeasureValue();
                list.add(mv);
    }
                it.univaq.disim.sealab.ttep.val.classes.ValSpec vs = new it.univaq.disim.sealab.ttep.val.classes.ValSpec(list);
                {if (true) return vs;}
    throw new Error("Missing return statement in function");
  }

  private boolean jj_2_1(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_1(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(0, xla); }
  }

  private boolean jj_2_2(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_2(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(1, xla); }
  }

  private boolean jj_2_3(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_3(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(2, xla); }
  }

  private boolean jj_2_4(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_4(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(3, xla); }
  }

  private boolean jj_2_5(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_5(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(4, xla); }
  }

  private boolean jj_2_6(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_6(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(5, xla); }
  }

  private boolean jj_2_7(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_7(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(6, xla); }
  }

  private boolean jj_2_8(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_8(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(7, xla); }
  }

  private boolean jj_3R_42() {
    if (jj_scan_token(T_TAIL)) return true;
    if (jj_scan_token(LPAREN)) return true;
    return false;
  }

  private boolean jj_3R_15() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_28()) {
    jj_scanpos = xsp;
    if (jj_3R_29()) return true;
    }
    return false;
  }

  private boolean jj_3R_28() {
    if (jj_scan_token(54)) return true;
    if (jj_3R_14()) return true;
    return false;
  }

  private boolean jj_3R_36() {
    if (jj_scan_token(T_READ)) return true;
    if (jj_scan_token(LPAREN)) return true;
    return false;
  }

  private boolean jj_3_5() {
    if (jj_3R_8()) return true;
    if (jj_scan_token(59)) return true;
    if (jj_3R_8()) return true;
    return false;
  }

  private boolean jj_3R_10() {
    if (jj_3R_14()) return true;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_15()) { jj_scanpos = xsp; break; }
    }
    return false;
  }

  private boolean jj_3R_35() {
    if (jj_scan_token(T_FIRST)) return true;
    if (jj_scan_token(LPAREN)) return true;
    return false;
  }

  private boolean jj_3_4() {
    if (jj_3R_8()) return true;
    if (jj_scan_token(GE)) return true;
    if (jj_3R_8()) return true;
    return false;
  }

  private boolean jj_3R_41() {
    if (jj_scan_token(T_LIST_CONS)) return true;
    if (jj_scan_token(LPAREN)) return true;
    return false;
  }

  private boolean jj_3R_38() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_41()) {
    jj_scanpos = xsp;
    if (jj_3R_42()) {
    jj_scanpos = xsp;
    if (jj_3R_43()) {
    jj_scanpos = xsp;
    if (jj_3R_44()) {
    jj_scanpos = xsp;
    if (jj_3R_45()) return true;
    }
    }
    }
    }
    return false;
  }

  private boolean jj_3R_34() {
    if (jj_3R_40()) return true;
    return false;
  }

  private boolean jj_3_3() {
    if (jj_3R_8()) return true;
    if (jj_scan_token(58)) return true;
    if (jj_3R_8()) return true;
    return false;
  }

  private boolean jj_3R_33() {
    if (jj_3R_39()) return true;
    return false;
  }

  private boolean jj_3R_27() {
    if (jj_scan_token(T_LENGTH)) return true;
    if (jj_scan_token(LPAREN)) return true;
    if (jj_3R_31()) return true;
    return false;
  }

  private boolean jj_3_2() {
    if (jj_3R_8()) return true;
    if (jj_scan_token(LE)) return true;
    if (jj_3R_8()) return true;
    return false;
  }

  private boolean jj_3R_32() {
    if (jj_3R_38()) return true;
    return false;
  }

  private boolean jj_3_1() {
    if (jj_3R_8()) return true;
    if (jj_scan_token(57)) return true;
    if (jj_3R_8()) return true;
    return false;
  }

  private boolean jj_3R_47() {
    if (jj_scan_token(T_WRITE)) return true;
    if (jj_scan_token(LPAREN)) return true;
    return false;
  }

  private boolean jj_3_8() {
    if (jj_3R_8()) return true;
    return false;
  }

  private boolean jj_3R_19() {
    if (jj_scan_token(T_FALSE)) return true;
    return false;
  }

  private boolean jj_3_7() {
    if (jj_3R_9()) return true;
    return false;
  }

  private boolean jj_3R_30() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_7()) {
    jj_scanpos = xsp;
    if (jj_3_8()) {
    jj_scanpos = xsp;
    if (jj_3R_32()) {
    jj_scanpos = xsp;
    if (jj_3R_33()) {
    jj_scanpos = xsp;
    if (jj_3R_34()) {
    jj_scanpos = xsp;
    if (jj_3R_35()) {
    jj_scanpos = xsp;
    if (jj_3R_36()) {
    jj_scanpos = xsp;
    if (jj_3R_37()) return true;
    }
    }
    }
    }
    }
    }
    }
    return false;
  }

  private boolean jj_3R_12() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_18()) {
    jj_scanpos = xsp;
    if (jj_3R_19()) {
    jj_scanpos = xsp;
    if (jj_3_1()) {
    jj_scanpos = xsp;
    if (jj_3_2()) {
    jj_scanpos = xsp;
    if (jj_3_3()) {
    jj_scanpos = xsp;
    if (jj_3_4()) {
    jj_scanpos = xsp;
    if (jj_3_5()) {
    jj_scanpos = xsp;
    if (jj_3_6()) {
    jj_scanpos = xsp;
    if (jj_3R_20()) {
    jj_scanpos = xsp;
    if (jj_3R_21()) return true;
    }
    }
    }
    }
    }
    }
    }
    }
    }
    return false;
  }

  private boolean jj_3R_18() {
    if (jj_scan_token(T_TRUE)) return true;
    return false;
  }

  private boolean jj_3R_46() {
    if (jj_scan_token(T_ARRAY_CONS)) return true;
    if (jj_scan_token(LPAREN)) return true;
    return false;
  }

  private boolean jj_3R_39() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_46()) {
    jj_scanpos = xsp;
    if (jj_3R_47()) return true;
    }
    return false;
  }

  private boolean jj_3R_26() {
    if (jj_scan_token(T_NUMBER)) return true;
    return false;
  }

  private boolean jj_3R_49() {
    if (jj_scan_token(T_PUT)) return true;
    if (jj_scan_token(LPAREN)) return true;
    return false;
  }

  private boolean jj_3R_23() {
    if (jj_scan_token(OR)) return true;
    if (jj_3R_12()) return true;
    return false;
  }

  private boolean jj_3R_25() {
    if (jj_3R_31()) return true;
    return false;
  }

  private boolean jj_3R_17() {
    if (jj_scan_token(DASH)) return true;
    if (jj_3R_10()) return true;
    return false;
  }

  private boolean jj_3R_14() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_24()) {
    jj_scanpos = xsp;
    if (jj_3R_25()) {
    jj_scanpos = xsp;
    if (jj_3R_26()) {
    jj_scanpos = xsp;
    if (jj_3R_27()) return true;
    }
    }
    }
    return false;
  }

  private boolean jj_3R_24() {
    if (jj_scan_token(LPAREN)) return true;
    if (jj_3R_30()) return true;
    if (jj_scan_token(RPAREN)) return true;
    return false;
  }

  private boolean jj_3R_13() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_22()) {
    jj_scanpos = xsp;
    if (jj_3R_23()) return true;
    }
    return false;
  }

  private boolean jj_3R_22() {
    if (jj_scan_token(AND)) return true;
    if (jj_3R_12()) return true;
    return false;
  }

  private boolean jj_3R_16() {
    if (jj_scan_token(56)) return true;
    if (jj_3R_10()) return true;
    return false;
  }

  private boolean jj_3R_11() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_16()) {
    jj_scanpos = xsp;
    if (jj_3R_17()) return true;
    }
    return false;
  }

  private boolean jj_3R_9() {
    if (jj_3R_12()) return true;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_13()) { jj_scanpos = xsp; break; }
    }
    return false;
  }

  private boolean jj_3R_48() {
    if (jj_scan_token(T_RECORD_CONS)) return true;
    if (jj_scan_token(LPAREN)) return true;
    return false;
  }

  private boolean jj_3R_40() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_48()) {
    jj_scanpos = xsp;
    if (jj_3R_49()) return true;
    }
    return false;
  }

  private boolean jj_3R_8() {
    if (jj_3R_10()) return true;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_11()) { jj_scanpos = xsp; break; }
    }
    return false;
  }

  private boolean jj_3R_45() {
    if (jj_scan_token(T_REMOVE)) return true;
    if (jj_scan_token(LPAREN)) return true;
    return false;
  }

  private boolean jj_3R_21() {
    if (jj_scan_token(60)) return true;
    if (jj_3R_12()) return true;
    return false;
  }

  private boolean jj_3R_44() {
    if (jj_scan_token(T_INSERT)) return true;
    if (jj_scan_token(LPAREN)) return true;
    return false;
  }

  private boolean jj_3R_31() {
    if (jj_scan_token(T_ID)) return true;
    return false;
  }

  private boolean jj_3R_20() {
    if (jj_scan_token(LPAREN)) return true;
    if (jj_3R_9()) return true;
    if (jj_scan_token(RPAREN)) return true;
    return false;
  }

  private boolean jj_3R_43() {
    if (jj_scan_token(T_CONCAT)) return true;
    if (jj_scan_token(LPAREN)) return true;
    return false;
  }

  private boolean jj_3R_29() {
    if (jj_scan_token(55)) return true;
    if (jj_3R_14()) return true;
    return false;
  }

  private boolean jj_3R_37() {
    if (jj_scan_token(T_GET)) return true;
    if (jj_scan_token(LPAREN)) return true;
    return false;
  }

  private boolean jj_3_6() {
    if (jj_3R_8()) return true;
    if (jj_scan_token(NE)) return true;
    if (jj_3R_8()) return true;
    return false;
  }

  /** Generated Token Manager. */
  public ValParserTokenManager token_source;
  JavaCharStream jj_input_stream;
  /** Current token. */
  public Token token;
  /** Next token. */
  public Token jj_nt;
  private int jj_ntk;
  private Token jj_scanpos, jj_lastpos;
  private int jj_la;
  private int jj_gen;
  final private int[] jj_la1 = new int[19];
  static private int[] jj_la1_0;
  static private int[] jj_la1_1;
  static {
      jj_la1_init_0();
      jj_la1_init_1();
   }
   private static void jj_la1_init_0() {
      jj_la1_0 = new int[] {0x4000,0x0,0x4000,0x0,0x4000,0x67000100,0x0,0x100,0x0,0x0,0x2000,0x2000,0x60000000,0x100,0x18000000,0x18000000,0x7000000,0x400,0x2000,};
   }
   private static void jj_la1_init_1() {
      jj_la1_1 = new int[] {0x0,0xc00,0x0,0x300,0x0,0x10009ffc,0xf8,0x9004,0xc00000,0xc00000,0x1000000,0x1000000,0x0,0x10000000,0x0,0x0,0xff8,0x0,0x0,};
   }
  final private JJCalls[] jj_2_rtns = new JJCalls[8];
  private boolean jj_rescan = false;
  private int jj_gc = 0;

  /** Constructor with InputStream. */
  public ValParser(java.io.InputStream stream) {
     this(stream, null);
  }
  /** Constructor with InputStream and supplied encoding */
  public ValParser(java.io.InputStream stream, String encoding) {
    try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
    token_source = new ValParserTokenManager(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 19; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  /** Reinitialise. */
  public void ReInit(java.io.InputStream stream) {
     ReInit(stream, null);
  }
  /** Reinitialise. */
  public void ReInit(java.io.InputStream stream, String encoding) {
    try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
    token_source.ReInit(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 19; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  /** Constructor. */
  public ValParser(java.io.Reader stream) {
    jj_input_stream = new JavaCharStream(stream, 1, 1);
    token_source = new ValParserTokenManager(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 19; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  /** Reinitialise. */
  public void ReInit(java.io.Reader stream) {
    jj_input_stream.ReInit(stream, 1, 1);
    token_source.ReInit(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 19; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  /** Constructor with generated Token Manager. */
  public ValParser(ValParserTokenManager tm) {
    token_source = tm;
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 19; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  /** Reinitialise. */
  public void ReInit(ValParserTokenManager tm) {
    token_source = tm;
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 19; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  private Token jj_consume_token(int kind) throws ParseException {
    Token oldToken;
    if ((oldToken = token).next != null) token = token.next;
    else token = token.next = token_source.getNextToken();
    jj_ntk = -1;
    if (token.kind == kind) {
      jj_gen++;
      if (++jj_gc > 100) {
        jj_gc = 0;
        for (int i = 0; i < jj_2_rtns.length; i++) {
          JJCalls c = jj_2_rtns[i];
          while (c != null) {
            if (c.gen < jj_gen) c.first = null;
            c = c.next;
          }
        }
      }
      return token;
    }
    token = oldToken;
    jj_kind = kind;
    throw generateParseException();
  }

  static private final class LookaheadSuccess extends java.lang.Error { }
  final private LookaheadSuccess jj_ls = new LookaheadSuccess();
  private boolean jj_scan_token(int kind) {
    if (jj_scanpos == jj_lastpos) {
      jj_la--;
      if (jj_scanpos.next == null) {
        jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
      } else {
        jj_lastpos = jj_scanpos = jj_scanpos.next;
      }
    } else {
      jj_scanpos = jj_scanpos.next;
    }
    if (jj_rescan) {
      int i = 0; Token tok = token;
      while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
      if (tok != null) jj_add_error_token(kind, i);
    }
    if (jj_scanpos.kind != kind) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
    return false;
  }


/** Get the next Token. */
  final public Token getNextToken() {
    if (token.next != null) token = token.next;
    else token = token.next = token_source.getNextToken();
    jj_ntk = -1;
    jj_gen++;
    return token;
  }

/** Get the specific Token. */
  final public Token getToken(int index) {
    Token t = token;
    for (int i = 0; i < index; i++) {
      if (t.next != null) t = t.next;
      else t = t.next = token_source.getNextToken();
    }
    return t;
  }

  private int jj_ntk() {
    if ((jj_nt=token.next) == null)
      return (jj_ntk = (token.next=token_source.getNextToken()).kind);
    else
      return (jj_ntk = jj_nt.kind);
  }

  private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
  private int[] jj_expentry;
  private int jj_kind = -1;
  private int[] jj_lasttokens = new int[100];
  private int jj_endpos;

  private void jj_add_error_token(int kind, int pos) {
    if (pos >= 100) return;
    if (pos == jj_endpos + 1) {
      jj_lasttokens[jj_endpos++] = kind;
    } else if (jj_endpos != 0) {
      jj_expentry = new int[jj_endpos];
      for (int i = 0; i < jj_endpos; i++) {
        jj_expentry[i] = jj_lasttokens[i];
      }
      jj_entries_loop: for (java.util.Iterator<?> it = jj_expentries.iterator(); it.hasNext();) {
        int[] oldentry = (int[])(it.next());
        if (oldentry.length == jj_expentry.length) {
          for (int i = 0; i < jj_expentry.length; i++) {
            if (oldentry[i] != jj_expentry[i]) {
              continue jj_entries_loop;
            }
          }
          jj_expentries.add(jj_expentry);
          break jj_entries_loop;
        }
      }
      if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
    }
  }

  /** Generate ParseException. */
  public ParseException generateParseException() {
    jj_expentries.clear();
    boolean[] la1tokens = new boolean[61];
    if (jj_kind >= 0) {
      la1tokens[jj_kind] = true;
      jj_kind = -1;
    }
    for (int i = 0; i < 19; i++) {
      if (jj_la1[i] == jj_gen) {
        for (int j = 0; j < 32; j++) {
          if ((jj_la1_0[i] & (1<<j)) != 0) {
            la1tokens[j] = true;
          }
          if ((jj_la1_1[i] & (1<<j)) != 0) {
            la1tokens[32+j] = true;
          }
        }
      }
    }
    for (int i = 0; i < 61; i++) {
      if (la1tokens[i]) {
        jj_expentry = new int[1];
        jj_expentry[0] = i;
        jj_expentries.add(jj_expentry);
      }
    }
    jj_endpos = 0;
    jj_rescan_token();
    jj_add_error_token(0, 0);
    int[][] exptokseq = new int[jj_expentries.size()][];
    for (int i = 0; i < jj_expentries.size(); i++) {
      exptokseq[i] = jj_expentries.get(i);
    }
    return new ParseException(token, exptokseq, tokenImage);
  }

  /** Enable tracing. */
  final public void enable_tracing() {
  }

  /** Disable tracing. */
  final public void disable_tracing() {
  }

  private void jj_rescan_token() {
    jj_rescan = true;
    for (int i = 0; i < 8; i++) {
    try {
      JJCalls p = jj_2_rtns[i];
      do {
        if (p.gen > jj_gen) {
          jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
          switch (i) {
            case 0: jj_3_1(); break;
            case 1: jj_3_2(); break;
            case 2: jj_3_3(); break;
            case 3: jj_3_4(); break;
            case 4: jj_3_5(); break;
            case 5: jj_3_6(); break;
            case 6: jj_3_7(); break;
            case 7: jj_3_8(); break;
          }
        }
        p = p.next;
      } while (p != null);
      } catch(LookaheadSuccess ls) { }
    }
    jj_rescan = false;
  }

  private void jj_save(int index, int xla) {
    JJCalls p = jj_2_rtns[index];
    while (p.gen > jj_gen) {
      if (p.next == null) { p = p.next = new JJCalls(); break; }
      p = p.next;
    }
    p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
  }

  static final class JJCalls {
    int gen;
    Token first;
    int arg;
    JJCalls next;
  }

}
