Peterson, Joe wrote:

Howdy,

 

I have a question about how to eliminate the “no start rule” warning when using a composite grammar.

 

It just means that none of the rules in the composite grammar consume until EOF. That will mean that the parser will just stop when a token comes up that isn't the start of a statement, rather than give you an error. so all you need do is make sure that the rule(s) you are going to invoke to start the parse end in EOF. As your list rule just calls stmt anyway, then have:

list : stmt+ EOF;

and in your main grammar, instead of list? just have:

local_list : stmt+ ;

then

group: section local_list? section2+ EOF;


You could also just use stmt* unless you have rewrites or actions in list.

But, whichever way you do it, all you need is that your top rule for either case ends in EOF.

Jim



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to