public final AntlrPilarParser.procExtension_return procExtension()
      throws RecognitionException {
    AntlrPilarParser.procExtension_return retval = new AntlrPilarParser.procExtension_return();
    retval.start = input.LT(1);
    int procExtension_StartIndex = input.index();
    Object root_0 = null;

    Token t = null;
    Token ID193 = null;
    Token char_literal194 = null;
    Token char_literal196 = null;
    Token char_literal198 = null;
    AntlrPilarParser.typeVarTuple_return typeVarTuple191 = null;

    AntlrPilarParser.type_return type192 = null;

    AntlrPilarParser.extParamList_return extParamList195 = null;

    AntlrPilarParser.annotationList_return annotationList197 = null;

    Object t_tree = null;
    Object ID193_tree = null;
    Object char_literal194_tree = null;
    Object char_literal196_tree = null;
    Object char_literal198_tree = null;
    RewriteRuleTokenStream stream_170 = new RewriteRuleTokenStream(adaptor,
        "token 170");
    RewriteRuleTokenStream stream_175 = new RewriteRuleTokenStream(adaptor,
        "token 175");
    RewriteRuleTokenStream stream_ID = new RewriteRuleTokenStream(adaptor,
        "token ID");
    RewriteRuleTokenStream stream_169 = new RewriteRuleTokenStream(adaptor,
        "token 169");
    RewriteRuleTokenStream stream_192 = new RewriteRuleTokenStream(adaptor,
        "token 192");
    RewriteRuleSubtreeStream stream_annotationList = new RewriteRuleSubtreeStream(
        adaptor, "rule annotationList");
    RewriteRuleSubtreeStream stream_extParamList = new RewriteRuleSubtreeStream(
        adaptor, "rule extParamList");
    RewriteRuleSubtreeStream stream_typeVarTuple = new RewriteRuleSubtreeStream(
        adaptor, "rule typeVarTuple");
    RewriteRuleSubtreeStream stream_type = new RewriteRuleSubtreeStream(
        adaptor, "rule type");
    try {
      if (state.backtracking > 0 && alreadyParsedRule(input, 50)) {
        return retval;
      }
      // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:423:2: (t= 'procdef' ( typeVarTuple )? ( type )? ID ( '(' extParamList ')' )? annotationList ';' -> ^( PROC_EXT[$t] ^( OPTION ( typeVarTuple )? ) ^( OPTION ( type )? ) ID ^( OPTION ( extParamList )? ) annotationList ) )
      // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:423:4: t= 'procdef' ( typeVarTuple )? ( type )? ID ( '(' extParamList ')' )? annotationList ';'
      {
        t = (Token) match(input, 192, FOLLOW_192_in_procExtension3608);
        if (state.failed) return retval;
        if (state.backtracking == 0) stream_192.add(t);

        // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:423:16: ( typeVarTuple )?
        int alt55 = 2;
        int LA55_0 = input.LA(1);

        if ((LA55_0 == 167)) {
          alt55 = 1;
        }
        switch (alt55) {
          case 1:
          // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:0:0: typeVarTuple
          {
            pushFollow(FOLLOW_typeVarTuple_in_procExtension3610);
            typeVarTuple191 = typeVarTuple();

            state._fsp--;
            if (state.failed) return retval;
            if (state.backtracking == 0)
              stream_typeVarTuple.add(typeVarTuple191.getTree());

          }
            break;

        }

        // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:423:30: ( type )?
        int alt56 = 2;
        int LA56_0 = input.LA(1);

        if ((LA56_0 == TYPEVARID || LA56_0 == 169 || LA56_0 == 177)) {
          alt56 = 1;
        } else if ((LA56_0 == ID)) {
          int LA56_2 = input.LA(2);

          if ((LA56_2 == ID || LA56_2 == 167 || LA56_2 == 177 || LA56_2 == 202
              || (LA56_2 >= 215 && LA56_2 <= 216) || LA56_2 == 225)) {
            alt56 = 1;
          }
        }
        switch (alt56) {
          case 1:
          // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:0:0: type
          {
            pushFollow(FOLLOW_type_in_procExtension3613);
            type192 = type();

            state._fsp--;
            if (state.failed) return retval;
            if (state.backtracking == 0) stream_type.add(type192.getTree());

          }
            break;

        }

        ID193 = (Token) match(input, ID, FOLLOW_ID_in_procExtension3616);
        if (state.failed) return retval;
        if (state.backtracking == 0) stream_ID.add(ID193);

        // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:424:4: ( '(' extParamList ')' )?
        int alt57 = 2;
        int LA57_0 = input.LA(1);

        if ((LA57_0 == 169)) {
          alt57 = 1;
        }
        switch (alt57) {
          case 1:
          // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:424:6: '(' extParamList ')'
          {
            char_literal194 = (Token) match(
                input,
                169,
                FOLLOW_169_in_procExtension3623);
            if (state.failed) return retval;
            if (state.backtracking == 0) stream_169.add(char_literal194);

            pushFollow(FOLLOW_extParamList_in_procExtension3625);
            extParamList195 = extParamList();

            state._fsp--;
            if (state.failed) return retval;
            if (state.backtracking == 0)
              stream_extParamList.add(extParamList195.getTree());
            char_literal196 = (Token) match(
                input,
                170,
                FOLLOW_170_in_procExtension3627);
            if (state.failed) return retval;
            if (state.backtracking == 0) stream_170.add(char_literal196);

          }
            break;

        }

        pushFollow(FOLLOW_annotationList_in_procExtension3635);
        annotationList197 = annotationList();

        state._fsp--;
        if (state.failed) return retval;
        if (state.backtracking == 0)
          stream_annotationList.add(annotationList197.getTree());
        char_literal198 = (Token) match(
            input,
            175,
            FOLLOW_175_in_procExtension3637);
        if (state.failed) return retval;
        if (state.backtracking == 0) stream_175.add(char_literal198);

        // AST REWRITE
        // elements: typeVarTuple, extParamList, annotationList, type, ID
        // 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();
          // 425:41: -> ^( PROC_EXT[$t] ^( OPTION ( typeVarTuple )? ) ^( OPTION ( type )? ) ID ^( OPTION ( extParamList )? ) annotationList )
          {
            // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:425:44: ^( PROC_EXT[$t] ^( OPTION ( typeVarTuple )? ) ^( OPTION ( type )? ) ID ^( OPTION ( extParamList )? ) annotationList )
            {
              Object root_1 = (Object) adaptor.nil();
              root_1 = (Object) adaptor.becomeRoot(
                  (Object) adaptor.create(PROC_EXT, t),
                  root_1);

              // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:425:59: ^( OPTION ( typeVarTuple )? )
              {
                Object root_2 = (Object) adaptor.nil();
                root_2 = (Object) adaptor.becomeRoot(
                    (Object) adaptor.create(OPTION, "OPTION"),
                    root_2);

                // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:425:68: ( typeVarTuple )?
                if (stream_typeVarTuple.hasNext()) {
                  adaptor.addChild(root_2, stream_typeVarTuple.nextTree());

                }
                stream_typeVarTuple.reset();

                adaptor.addChild(root_1, root_2);
              }
              // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:425:83: ^( OPTION ( type )? )
              {
                Object root_2 = (Object) adaptor.nil();
                root_2 = (Object) adaptor.becomeRoot(
                    (Object) adaptor.create(OPTION, "OPTION"),
                    root_2);

                // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:425:92: ( type )?
                if (stream_type.hasNext()) {
                  adaptor.addChild(root_2, stream_type.nextTree());

                }
                stream_type.reset();

                adaptor.addChild(root_1, root_2);
              }
              adaptor.addChild(root_1, stream_ID.nextNode());
              // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:425:102: ^( OPTION ( extParamList )? )
              {
                Object root_2 = (Object) adaptor.nil();
                root_2 = (Object) adaptor.becomeRoot(
                    (Object) adaptor.create(OPTION, "OPTION"),
                    root_2);

                // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:425:111: ( extParamList )?
                if (stream_extParamList.hasNext()) {
                  adaptor.addChild(root_2, stream_extParamList.nextTree());

                }
                stream_extParamList.reset();

                adaptor.addChild(root_1, root_2);
              }
              adaptor.addChild(root_1, stream_annotationList.nextTree());

              adaptor.addChild(root_0, root_1);
            }

          }

          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, 50, procExtension_StartIndex);
      }
    }
    return retval;
  }