[antlr-interest] linear list from tree

Marc mschellens at gmail.com
Wed Aug 10 06:36:10 PDT 2005


I would like to build a linear list made from the 'expr' which are
spread over a tree.
The following grammer fragment does not work.
So how to do it?

Thanks,
marc

output should be:
#( ARRAYIN e1_1 e1_2 e1_3 ...)
// _1, _2 ... loop number


arrayindex_list!
    : ( #(ARRAYIX
                ( ALL
                | ( e1:expr // 0 or 2
                        {
                                      #arrayindex_list = #( NULL,
(arrayindex_list),e1);
// also not working:        #arrayindex_list = #( arrayindex_list,e1);
//                                    #arrayindex_list = #(
(arrayindex_list),e1);


                        }
                    )
                )
        )+
        {
//            #arrayindex_list = #([ARRAYIX,"[...]"], arrayindex_list);
//            #arrayindex_list->SetArrayIndexList( ixList.release());
        }
    ;


More information about the antlr-interest mailing list