[antlr-interest] problem with composing grammars: thanks and comments 

Jean-Claude Durand Jean-Claude.Durand at imag.fr
Thu Jul 24 02:42:07 PDT 2008


Thanks for your  answer, I succeeded in compiling and running a small  
example.

Here are my comments:
- putting the lex grammar as the first import does not help;
- So, as you said, I declared the the 'lexer grammar' as 'grammar'  
and run ANTLR on it, and also on the "composed grammar". Thus I got  
all the files
(even one parser more, I do not use in compiling);
- the remaining problem, is that the definitions of the tokens  
( #define ...) are not the same in the different .h files (see my  
example below) and
some are missing. I just have to modify the files with the  
definitions given by LexLexer.h or LexParser.h, and it works !




Have a nice day,

Jean-Claude Durand

LIG, équipe GETALP
385, rue de la Bibliothèque
BP 53
38041 Grenoble cedex 9
FRANCE
Jean-Claude.Durand at imag.fr
tél: +33 (0)4 76 51 43 81
fax: +33 (0)4 76 51 44 05

Le 22 juil. 08 à 15:45, Jim Idle a écrit :
Try putting the lex grammar as the first import. Not sure it will  
help but worth a try. Also you have lexer grammar and maybe just need  
grammar! But I also discovered some similar issues and terence is  
aware of them. For now use the lexer grammar stand alone and make the  
others parser grammars. There is no difference at run time.

ANTLR grammars are parsed with ANTLR 2 so you cannot use diacritics  
directly. You must use the equivalent \unnnn and then it is fine.
Sent via BlackBerry from T-Mobile



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080724/a09149c6/attachment-0002.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: composedGrammarsExample.tar.gz
Type: application/x-gzip
Size: 16664 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080724/a09149c6/attachment-0001.gz 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080724/a09149c6/attachment-0003.html 


More information about the antlr-interest mailing list