I experienced the same problem and did not find a proper solution for it. As a 
work-around, I have found that adding a dummy lexer rule to the composite 
grammar causes the lexer to be generated.

grammar C ;
import L, P2 ;

stuff : ( letters spaces )+ ;
dummy : 'DUMMY';


In general, I would expect that no parser or lexer rule is required in the 
composite grammar. This way, we can use the composite grammer only as a way to 
glue things together and specify generation options for a particular use.

I hope this is of any help to you.

Best regards,

Ranco Marcus


From: [email protected] 
[mailto:[email protected]] On Behalf Of Stevenson, Todd (GE 
Healthcare, consultant)
Sent: dinsdag 1 december 2009 19:09
To: [email protected]
Subject: [antlr-interest] Antlr does not generate Lexer from a composite grammar

I built the grammars described at the bottom of the Composite Grammars page of 
the Antlr documentation(i.e.  L, P1, P2, and C).  When I run Antlr with no 
command line arguments on the combined grammar 'C', it generates C_P1.java, 
C_P2_P1.java, and CParser.java, but does not generate CLexer.java.   Is this 
correct behavior?  If so, how to I call the lexer from my source java program?

When I build the other grammars on that page (Root and Delegate), and run Antlr 
on 'Root', it generates RootParser.java Root_Delegate.java and RootLexer.java.

thanks.

I tried it with Antlr 3.2 and Antlr 3.1.3.



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

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

Reply via email to