public final AntlrPilarParser.extendClause_return extendClause()
      throws RecognitionException {
    AntlrPilarParser.extendClause_return retval = new AntlrPilarParser.extendClause_return();
    retval.start = input.LT(1);
    int extendClause_StartIndex = input.index();
    Object root_0 = null;

    Token t = null;
    Token char_literal93 = null;
    AntlrPilarParser.extendClauseElement_return extendClauseElement92 = null;

    AntlrPilarParser.extendClauseElement_return extendClauseElement94 = null;

    Object t_tree = null;
    Object char_literal93_tree = null;
    RewriteRuleTokenStream stream_182 = new RewriteRuleTokenStream(adaptor,
        "token 182");
    RewriteRuleTokenStream stream_172 = new RewriteRuleTokenStream(adaptor,
        "token 172");
    RewriteRuleSubtreeStream stream_extendClauseElement = new RewriteRuleSubtreeStream(
        adaptor, "rule extendClauseElement");
    try {
      if (state.backtracking > 0 && alreadyParsedRule(input, 28)) {
        return retval;
      }
      // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:301:2: (t= 'extends' extendClauseElement ( ',' extendClauseElement )* -> ^( LIST[$t] ( extendClauseElement )+ ) )
      // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:301:4: t= 'extends' extendClauseElement ( ',' extendClauseElement )*
      {
        t = (Token) match(input, 182, FOLLOW_182_in_extendClause2295);
        if (state.failed) return retval;
        if (state.backtracking == 0) stream_182.add(t);

        pushFollow(FOLLOW_extendClauseElement_in_extendClause2297);
        extendClauseElement92 = extendClauseElement();

        state._fsp--;
        if (state.failed) return retval;
        if (state.backtracking == 0)
          stream_extendClauseElement.add(extendClauseElement92.getTree());
        // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:302:4: ( ',' extendClauseElement )*
        loop23: do {
          int alt23 = 2;
          int LA23_0 = input.LA(1);

          if ((LA23_0 == 172)) {
            alt23 = 1;
          }

          switch (alt23) {
            case 1:
            // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:302:6: ',' extendClauseElement
            {
              char_literal93 = (Token) match(
                  input,
                  172,
                  FOLLOW_172_in_extendClause2304);
              if (state.failed) return retval;
              if (state.backtracking == 0) stream_172.add(char_literal93);

              pushFollow(FOLLOW_extendClauseElement_in_extendClause2306);
              extendClauseElement94 = extendClauseElement();

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

            }
              break;

            default:
              break loop23;
          }
        } while (true);

        // AST REWRITE
        // elements: extendClauseElement
        // 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();
          // 302:41: -> ^( LIST[$t] ( extendClauseElement )+ )
          {
            // /Users/robby/Repositories/sireum-parser/sireum-parser/src/main/java/org/sireum/pilar/parser/AntlrPilar.g:302:44: ^( LIST[$t] ( extendClauseElement )+ )
            {
              Object root_1 = (Object) adaptor.nil();
              root_1 = (Object) adaptor.becomeRoot(
                  (Object) adaptor.create(LIST, t),
                  root_1);

              if (!(stream_extendClauseElement.hasNext())) {
                throw new RewriteEarlyExitException();
              }
              while (stream_extendClauseElement.hasNext()) {
                adaptor.addChild(root_1, stream_extendClauseElement.nextTree());

              }
              stream_extendClauseElement.reset();

              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, 28, extendClause_StartIndex);
      }
    }
    return retval;
  }