[antlr-interest] Partial grammars/include

Kay Roepke kroepke at classdump.org
Fri Jan 5 09:31:52 PST 2007


Hi Gyula!

On 5. Jan 2007, at 17:04 , Gyula László wrote:

> The solution I think is simple: partial grammars, or even more  
> simple: an #include-like macro to include other files:
>
> 	#inlude "partials/statements.g"
> 	#inlude "partials/expressions.g"
>
> , or something in options:
>
> 	options { language=ObjC; partials=["statements", "expressions",  
> "annotations" ]; }
>
> This could cut down the clutter of grammars.
> Any toughts? Should I write a proof-of-concept java bit, or does  
> this whole thing stink?

Ter wants to bring back grammar inheritance at some point in the  
future, that will be even more powerful. It's a bit much to do right now
with him finishing the book and trying to fix the last critical bugs  
for 3.0, but I gather it will come back.

Then you can just override the bits and pieces that are different for  
each pass while retaining the common parts. It should work even  
better than an including scheme. Also, in 3.0b6 skipping subtrees  
works, so that could make your live easier, too. Unfortunately work  
has kept me from integrating all the changes Ter has made over  
Christmas, so the depot version (ObjC target) will not run currently.

I'm working on it, but I can't promise any date. I've also no idea  
what Ter's timeframe for the b6 release is.

cheers,

-k
-- 
Kay Röpke
http://classdump.org/






More information about the antlr-interest mailing list