[antlr-interest] problem with composing grammars
Jean-Claude Durand
jean-claude.durand at imag.fr
Tue Jul 22 02:26:14 PDT 2008
I try to compose grammars via the import instruction. The example
'composite-java' works well, but mine
not: 'lexer' files are not generated.
I use the Version 3.1b2 of ANTLR with the C target option.
Here is a very simplified example from my grammars:
// file TRACOMPL.g:
grammar TRACOMPL;
options {language=C; }
import Dv, Dproc, Lex;
tracompl:
dv
dproc
;
// file Lex.g
lexer grammar Lex;
DECVAR: '-DECVAR-' ;
DPROC: '-DPROC-' ;
LITTERAL: ('a'..'z' | 'A'..'Z' | '0'..'9')+ ;
POINT: '.' ;
// file Dv.g:
parser grammar Dv;
dv :
DECVAR
LITTERAL
POINT
;
// and file Dproc.g:
parser grammar Dproc;
dproc:
PROC
dprocet
;
dprocet:
(
LITTERAL POINT
)*
;
"java org.antlr.Tool TRACOMPL.g" only generates the .h and .c files
TRACOMPLParser, TRACOMPL_Dv
and TRACOMPL_Dproc.
By calling directly the same command on Lex.g, it is possible to get
the Lex.h
and Lex.c files (I added the 'language=C' in the Lex.g file). I
should not have to do it.
I don't know how to get the 'TRACOMPLLexer'
.h and .c files (the equivalent of 'JavaLexer' in the composite-java
example).
The example:

Another question I submitted a long time ago: it is always impossible to
use 'à' ( a accent grave) even in comments of .g files, and in french
we need it ! ;-)
Thanks a lot,
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080722/5d88df2f/attachment-0002.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simple.tar
Type: application/x-tar
Size: 10240 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080722/5d88df2f/attachment-0001.tar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080722/5d88df2f/attachment-0003.html
More information about the antlr-interest
mailing list