[antlr-interest] ANTLR and ANT

Bogdan Mitu bogdan_mt at yahoo.com
Tue May 28 01:13:42 PDT 2002


Hi Silvain,

If I remember correctly, glib=..." is a command-line-only option. You
probably added new attributes to the ANTLR task. My modifications don't deal
with supergrammars (in fact I don't use them, I prefer to use literate
programming to produce different variations of a grammar). But your changes
and mine can be merged. To make more clear what modifications I made, here
is a fragment from my post to ant-dev:

>>>
Working with the ANTLR task I saw that it (the ANTLR task) is somehow
limited when it tries to determine if the source grammar is "dirty" or not:

- It considers the output of ANTLR to be one file per grammar, while in fact
there are 2 (or even 3): XxxParser.java, XxxParserTokenTypes.java and
possibly XxxParserTokenTypes.txt. If any of one is missing, the grammar
should be recompiled, which currently happens only for XxxParser.java.

- An ANTLR file can contain more than one grammar (any combination of lexer,
parser and tree parser grammars). Once again, multiple output files, and
each of them missing should trigger the recompilation of the grammar.

- ANTLR grammars can export/import token lists through "vocabulary files" -
XxxTokenTypes.txt. If the imported file is newer than the grammar file, the
grammar should be recompiled to include the correct tokens in generated
code.

The main problem lays in the method getGeneratedFile(), which returns only
one file, while in fact we need two lists of files, ones that are results of
the grammar, and should be *older* than the grammar, and a list of imported
files, which should be *younger* than the grammar file.
<<<

The new task parses the grammar file to determine all generated files and
all imported files, so that it can make a better decision. It doesn't know
anything about supergrammars. And you're right, it should. If you send me
your changes, I will try to incorporate them.

Regards,
Bogdan 


--- Silvain Piree <s.piree at enneya.com> wrote:
> 
> Bogdan,
> 
> > I wrote a new ANTLR task, which uses a parser to analyze all
> > dependencies, and sent it to ant-dev. However, the process of 
> > review/adoption is very slow, ANTLR not being their top priority. 
> > If someone is interested, I can post the patch.
> 
> I've also made some small changes to the ANTLR task from ANT: 
> I've added the ability to specify the location of base grammars
> from which to inherit using "glib=...", "glib2=...", etc.
> 
> I've also added some checking to see if the base grammars are
> more recent than the grammar to be processed, so ANTLR
> is only activated when really needed. Works fine for me.
> 
> In what way do your changes of the ANTLR task solve that problem.
> Most noteably, how do you know where the base grammars are
> located? In my case they are in several different directories.
> 
> Kind greetings, Silvain
> 
> 
> 
>  
> 
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list