public final AntlrPilarParser.packageElement_return packageElement()
      throws RecognitionException {
    AntlrPilarParser.packageElement_return retval = new AntlrPilarParser.packageElement_return();
    retval.start = input.LT(1);
    int packageElement_StartIndex = input.index();
    Object root_0 = null;

    AntlrPilarParser.constDeclaration_return constDeclaration50 = null;

    AntlrPilarParser.enumDeclaration_return enumDeclaration51 = null;

    AntlrPilarParser.typealiasDeclaration_return typealiasDeclaration52 = null;

    AntlrPilarParser.recordDeclaration_return recordDeclaration53 = null;

    AntlrPilarParser.globalVarsDeclaration_return globalVarsDeclaration54 = null;

    AntlrPilarParser.procedureDeclaration_return procedureDeclaration55 = null;

    AntlrPilarParser.virtualSetDeclaration_return virtualSetDeclaration56 = null;

    AntlrPilarParser.funexpDeclaration_return funexpDeclaration57 = null;

    AntlrPilarParser.extDeclaration_return extDeclaration58 = null;

    try {
      if (state.backtracking > 0 && alreadyParsedRule(input, 19)) {
        return retval;
      }
      // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:249:2: ( constDeclaration | enumDeclaration | typealiasDeclaration | recordDeclaration | globalVarsDeclaration | procedureDeclaration | virtualSetDeclaration | funexpDeclaration | extDeclaration )
      int alt16 = 9;
      switch (input.LA(1)) {
        case 176: {
          alt16 = 1;
        }
          break;
        case 179: {
          alt16 = 2;
        }
          break;
        case 180: {
          alt16 = 3;
        }
          break;
        case 181: {
          alt16 = 4;
        }
          break;
        case 183: {
          alt16 = 5;
        }
          break;
        case 184: {
          alt16 = 6;
        }
          break;
        case 186: {
          alt16 = 7;
        }
          break;
        case 187: {
          alt16 = 8;
        }
          break;
        case 188: {
          alt16 = 9;
        }
          break;
        default:
          if (state.backtracking > 0) {
            state.failed = true;
            return retval;
          }
          NoViableAltException nvae = new NoViableAltException("", 16, 0, input);

          throw nvae;
      }

      switch (alt16) {
        case 1:
        // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:249:4: constDeclaration
        {
          root_0 = (Object) adaptor.nil();

          pushFollow(FOLLOW_constDeclaration_in_packageElement1794);
          constDeclaration50 = constDeclaration();

          state._fsp--;
          if (state.failed) return retval;
          if (state.backtracking == 0)
            adaptor.addChild(root_0, constDeclaration50.getTree());

        }
          break;
        case 2:
        // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:250:4: enumDeclaration
        {
          root_0 = (Object) adaptor.nil();

          pushFollow(FOLLOW_enumDeclaration_in_packageElement1799);
          enumDeclaration51 = enumDeclaration();

          state._fsp--;
          if (state.failed) return retval;
          if (state.backtracking == 0)
            adaptor.addChild(root_0, enumDeclaration51.getTree());

        }
          break;
        case 3:
        // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:251:4: typealiasDeclaration
        {
          root_0 = (Object) adaptor.nil();

          pushFollow(FOLLOW_typealiasDeclaration_in_packageElement1804);
          typealiasDeclaration52 = typealiasDeclaration();

          state._fsp--;
          if (state.failed) return retval;
          if (state.backtracking == 0)
            adaptor.addChild(root_0, typealiasDeclaration52.getTree());

        }
          break;
        case 4:
        // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:252:4: recordDeclaration
        {
          root_0 = (Object) adaptor.nil();

          pushFollow(FOLLOW_recordDeclaration_in_packageElement1809);
          recordDeclaration53 = recordDeclaration();

          state._fsp--;
          if (state.failed) return retval;
          if (state.backtracking == 0)
            adaptor.addChild(root_0, recordDeclaration53.getTree());

        }
          break;
        case 5:
        // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:253:4: globalVarsDeclaration
        {
          root_0 = (Object) adaptor.nil();

          pushFollow(FOLLOW_globalVarsDeclaration_in_packageElement1814);
          globalVarsDeclaration54 = globalVarsDeclaration();

          state._fsp--;
          if (state.failed) return retval;
          if (state.backtracking == 0)
            adaptor.addChild(root_0, globalVarsDeclaration54.getTree());

        }
          break;
        case 6:
        // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:254:4: procedureDeclaration
        {
          root_0 = (Object) adaptor.nil();

          pushFollow(FOLLOW_procedureDeclaration_in_packageElement1819);
          procedureDeclaration55 = procedureDeclaration();

          state._fsp--;
          if (state.failed) return retval;
          if (state.backtracking == 0)
            adaptor.addChild(root_0, procedureDeclaration55.getTree());

        }
          break;
        case 7:
        // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:255:4: virtualSetDeclaration
        {
          root_0 = (Object) adaptor.nil();

          pushFollow(FOLLOW_virtualSetDeclaration_in_packageElement1824);
          virtualSetDeclaration56 = virtualSetDeclaration();

          state._fsp--;
          if (state.failed) return retval;
          if (state.backtracking == 0)
            adaptor.addChild(root_0, virtualSetDeclaration56.getTree());

        }
          break;
        case 8:
        // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:256:4: funexpDeclaration
        {
          root_0 = (Object) adaptor.nil();

          pushFollow(FOLLOW_funexpDeclaration_in_packageElement1829);
          funexpDeclaration57 = funexpDeclaration();

          state._fsp--;
          if (state.failed) return retval;
          if (state.backtracking == 0)
            adaptor.addChild(root_0, funexpDeclaration57.getTree());

        }
          break;
        case 9:
        // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:257:4: extDeclaration
        {
          root_0 = (Object) adaptor.nil();

          pushFollow(FOLLOW_extDeclaration_in_packageElement1834);
          extDeclaration58 = extDeclaration();

          state._fsp--;
          if (state.failed) return retval;
          if (state.backtracking == 0)
            adaptor.addChild(root_0, extDeclaration58.getTree());

        }
          break;

      }
      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, 19, packageElement_StartIndex);
      }
    }
    return retval;
  }