public final void index() throws RecognitionException
    {
        
        AST ast1 = null, ast2 = null;
        
        try {
            // CPP.g:812:3: ( '[' expr ']' index | )
            int alt51 = 2;
            int LA51_0 = this.input.LA(1);
            
            if ((LA51_0 == 25)) {
                alt51 = 1;
            }
            else if (((LA51_0 == EOF) || ((LA51_0 >= 23) && (LA51_0 <= 24)) || ((LA51_0 >= 26) && (LA51_0 <= 27))
                    || ((LA51_0 >= 29) && (LA51_0 <= 30)) || ((LA51_0 >= 43) && (LA51_0 <= 44)) || (LA51_0 == 52) || ((LA51_0 >= 57) && (LA51_0 <= 85)))) {
                alt51 = 2;
            }
            else {
                if (this.state.backtracking > 0) {
                    this.state.failed = true;
                    return;
                }
                NoViableAltException nvae = new NoViableAltException("", 51, 0, this.input);
                
                throw nvae;
            }
            switch (alt51)
            {
                case 1:
                    // CPP.g:812:5: '[' expr ']' index
                {
                    this.match(this.input, 25, FOLLOW_25_in_index3674);
                    if (this.state.failed) {
                        return;
                    }
                    this.pushFollow(FOLLOW_expr_in_index3681);
                    this.expr();
                    
                    this.state._fsp--;
                    if (this.state.failed) {
                        return;
                    }
                    if (this.state.backtracking == 0) {
                        ast1 = this.out;
                        this.out = null;
                    }
                    this.match(this.input, 26, FOLLOW_26_in_index3689);
                    if (this.state.failed) {
                        return;
                    }
                    this.pushFollow(FOLLOW_index_in_index3696);
                    this.index();
                    
                    this.state._fsp--;
                    if (this.state.failed) {
                        return;
                    }
                    if (this.state.backtracking == 0) {
                        ast2 = this.out;
                        this.out = null;
                    }
                    if (this.state.backtracking == 0) {
                        this.out = new ExprListAST((ExprAST) ast1, (ExprListAST) ast2);
                    }
                    
                }
                    break;
                case 2:
                    // CPP.g:817:5:
                {
                    if (this.state.backtracking == 0) {
                        this.out = new EmptyExprListAST();
                    }
                    
                }
                    break;
                
            }
        }
        catch (RecognitionException re) {
            this.reportError(re);
            this.recover(this.input, re);
        } finally {
        }
        return;
    }