Howdy,

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

I've had to make a change to my grammar recently that requires me to use a rule 
in a file that I use elsewhere. The rule is in a separate file and I want to 
keep that to make it easier to maintain. Because I have two locations that I 
need to use it, I wind up with the warning: warning(138): another_file.g:0:0: 
grammar another_file: no start rule (no rule can obviously be followed by EOF).

Now, I want to figure out how to reuse the rule in a separate file without this 
warning. Below is a super stripped version of the files with the names changed 
to protect confidentiality. (And a lot of white space removed.)

The only way I've found to eliminate it to create a single rule to call the 
common rule.  For example, in the below, I could add a rule "common_list" in 
main.g and then change all the list references to common_list.  That is not a 
very satisfactory solution to me.  Is there another way?

-JEEP

//Main.g
grammar main;
options {    language = C; }
import a_file, another_file;
unit  : list? group;
// can add: common_list : list here, but seems no so good to me
HRM : 'Hrm';
SIGH : 'Sigh' ;
KEYWORD : 'Keyword' ;
ITEMS : 'Items' ;
SEMICOLON : ';'  ;

////
// a_file.g
parser grammar a_file;
group : section list? section2+  ;
section  : HRM    ;
section2   : SIGH ;

////
// another_file.g
parser grammar another_file;
list: stmt+;
stmt : KEYWORD items SEMICOLON;
items: ITEMS;

--~--~---------~--~----~------------~-------~--~----~
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