public final AntlrPilarParser.modelFile_return modelFile()
      throws RecognitionException {
    AntlrPilarParser.modelFile_return retval = new AntlrPilarParser.modelFile_return();
    retval.start = input.LT(1);
    int modelFile_StartIndex = input.index();
    Object root_0 = null;

    Token EOF2 = null;
    AntlrPilarParser.model_return model1 = null;

    Object EOF2_tree = null;
    RewriteRuleTokenStream stream_EOF = new RewriteRuleTokenStream(adaptor,
        "token EOF");
    RewriteRuleSubtreeStream stream_model = new RewriteRuleSubtreeStream(
        adaptor, "rule model");
    try {
      if (state.backtracking > 0 && alreadyParsedRule(input, 1)) {
        return retval;
      }
      // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:166:2: ( model EOF -> model )
      // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:166:4: model EOF
      {
        pushFollow(FOLLOW_model_in_modelFile668);
        model1 = model();

        state._fsp--;
        if (state.failed) return retval;
        if (state.backtracking == 0) stream_model.add(model1.getTree());
        EOF2 = (Token) match(input, EOF, FOLLOW_EOF_in_modelFile670);
        if (state.failed) return retval;
        if (state.backtracking == 0) stream_EOF.add(EOF2);

        // AST REWRITE
        // elements: model
        // token labels: 
        // rule labels: retval
        // token list labels: 
        // rule list labels: 
        // wildcard labels: 
        if (state.backtracking == 0) {
          retval.tree = root_0;
          RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(
              adaptor, "rule retval", retval != null ? retval.tree : null);

          root_0 = (Object) adaptor.nil();
          // 166:41: -> model
          {
            adaptor.addChild(root_0, stream_model.nextTree());

          }

          retval.tree = root_0;
        }
      }

      retval.stop = input.LT(-1);

      if (state.backtracking == 0) {

        retval.tree = (Object) adaptor.rulePostProcessing(root_0);
        adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
      }
    } catch (RecognitionException re) {
      reportError(re);
      recover(input, re);
      retval.tree = (Object) adaptor.errorNode(
          input,
          retval.start,
          input.LT(-1),
          re);

    } finally {
      if (state.backtracking > 0) {
        memoize(input, 1, modelFile_StartIndex);
      }
    }
    return retval;
  }