public final NTSParser.dvar_annot_return dvar_annot() throws RecognitionException {
        NTSParser.dvar_annot_return retval = new NTSParser.dvar_annot_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token name=null;
        Token LPAR_S76=null;
        Token RPAR_S78=null;
        NTSParser.expr_return expr77 = null;


        CommonTree name_tree=null;
        CommonTree LPAR_S76_tree=null;
        CommonTree RPAR_S78_tree=null;

        try {
            // /home/filip/workspace/nts/src/nts/parser/NTS.g:550:3: (name= IDN ( LPAR_S ( expr )? RPAR_S )* )
            // /home/filip/workspace/nts/src/nts/parser/NTS.g:550:5: name= IDN ( LPAR_S ( expr )? RPAR_S )*
            {
            root_0 = (CommonTree)adaptor.nil();

             int s=0; // 0=(basic type), 1=(pure array reference), 2=(not pure array reference);  0-initial, 0->1, 0->2 OK 
                  int x=0; // total dimension
                  int y=0; // own dimension
                
            name=(Token)match(input,IDN,FOLLOW_IDN_in_dvar_annot1742); 
            name_tree = (CommonTree)adaptor.create(name);
            adaptor.addChild(root_0, name_tree);

            // /home/filip/workspace/nts/src/nts/parser/NTS.g:555:5: ( LPAR_S ( expr )? RPAR_S )*
            loop23:
            do {
                int alt23=2;
                int LA23_0 = input.LA(1);

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


                switch (alt23) {
            	case 1 :
            	    // /home/filip/workspace/nts/src/nts/parser/NTS.g:555:7: LPAR_S ( expr )? RPAR_S
            	    {
            	    LPAR_S76=(Token)match(input,LPAR_S,FOLLOW_LPAR_S_in_dvar_annot1750); 
            	    LPAR_S76_tree = (CommonTree)adaptor.create(LPAR_S76);
            	    adaptor.addChild(root_0, LPAR_S76_tree);

            	     x++; 
            	    // /home/filip/workspace/nts/src/nts/parser/NTS.g:557:7: ( expr )?
            	    int alt22=2;
            	    alt22 = dfa22.predict(input);
            	    switch (alt22) {
            	        case 1 :
            	            // /home/filip/workspace/nts/src/nts/parser/NTS.g:557:9: expr
            	            {
            	            pushFollow(FOLLOW_expr_in_dvar_annot1769);
            	            expr77=expr();

            	            state._fsp--;

            	            adaptor.addChild(root_0, expr77.getTree());
            	             if (s==1) {
            	                        System.err.println("Syntax error at "+Common.at(name)+". Reference to array of specific sizes is not a valid type.");
            	                        System.exit(1);
            	                      }
            	                      if (s==0) s=2;
            	                      y++;
            	                    

            	            }
            	            break;

            	    }

            	     if (s==0) s=1; 
            	    RPAR_S78=(Token)match(input,RPAR_S,FOLLOW_RPAR_S_in_dvar_annot1806); 
            	    RPAR_S78_tree = (CommonTree)adaptor.create(RPAR_S78);
            	    adaptor.addChild(root_0, RPAR_S78_tree);


            	    }
            	    break;

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

             listener.declarationAdd(name,y,x); 

            }

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

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }

          catch (RecognitionException ex) {
            reportError(ex);
            System.exit(1);
          }
        finally {
        }
        return retval;
    }