Great! That should do, but I am unsure of possible limitations yet. On Tue, Feb 2, 2010 at 12:46 PM, Kay Röpke <[email protected]> wrote:
> Hi! > > > On Feb 2, 2010, at 9:52 AM, Yauhen Yakimovich wrote: > > Dear all, >> >> I am not sure that I have seen this feature request previously, i.e. >> * grammar inclusion - the possibility to split grammar into units (files, >> etc) and the mechanism enabling one unit to refer another one; >> * namespacing - obviously it should be posiible to use such referring >> mechanism in some rational manner, for instance, with alias referring and >> closures. >> >> I really miss these features. It would be really great to see them in v4 >> if >> there are more people looking for them ;) >> > > > Have you seen the grammar import/delegation feature? (I vividly remember > the discussions for v3.1 and abusing lots of whiteboard space :)) > That should do what you need. > > http://www.antlr.org/wiki/display/ANTLR3/Composite+Grammars and > http://www.antlr.org/wiki/display/ANTLR3/Grammars > > AFAIK you can name the delegates with > import del1 = Declarations; > but I haven't actually used that yet. > The first URL has more information on the usage and implications, otherwise > the best bet is to ask in antlr-interest for help. > > I do use importing, though, mostly to work around a Java limitation. One > grammar ended up with exceeding a max method size or something, so I > refactored it a bit and split stuff out into separate grammars. > Didn't have the need for grammar reuse all that much yet, but I can see a > couple of use cases where that could come in handy. > > cheers, > -k > > -- > Kay Röpke > > -- With best regards, Y.Y.
_______________________________________________ antlr-dev mailing list [email protected] http://www.antlr.org/mailman/listinfo/antlr-dev
