[antlr-interest] PreservingFileWriter

Ric Klaren klaren at cs.utwente.nl
Tue Jun 11 08:03:48 PDT 2002


On Tue, Jun 11, 2002 at 06:19:29AM -0700, Bogdan Mitu wrote:
> I don't know much about C++ (<RETURN-RANT> more precisely, I don't want to
> remember </RETURN-RANT>),

Touche ;) I was a bit overbearing I guess sorry.

> so I speak only for Java environments. My Ant task
> is looking at the imported token files and at the generated files, and only
> if dates are wrong, it invokes ANTLR again. So it avoids all unnecessary
> recompilation, except for cases when you add a whitespace in the grammar. It
> also save time by not invoking ANTLR at all, when it's not necessary.

Ack, basically the same as make but with C++ it goes wrong on touching the
generated header file for the parser.

> By the way, you can do the same in PreservingFileWriter; you have all
> information required about supergrammars, imported files and generated files
> collected during grammar analysis by ANTLR.

In theory yes.. only making it work in the current codebase makes me less
enthousiastic. This info is basically non existent at the moment the
filewriter is created.

> > Makefile's allow me to do things in a very flexible way and
> > I
> > for as far as Makefile syntax can be cryptic it certainly beats XML
> Just incidentally, the next incarnation of Ant (Ant 2) will be independent
> of XML or other particular encoding, which I think it's a step in the right
> direction.

I'll most certainly will have a look at it again.

> > If I look at compilation times then running antlr is probably less than 1%
> > of the time to compile the generated files (and without minimal remakes,
> > this probably will go into the 0.001% (okay I may be exagerating here..
> > but
> > it means that I would get lethal doses of caffeine)). My educated guess is
> > that in very few projects antlr's runtime is the biggest factor. So I'm
> > inclined to keep this thing the default. (if someone provides a 'clean'
> > patch I would not dream of objecting though)

> You are probably right about times, it's more a psychological factor (<RANT>
> against improvements that make things slower </RANT>).

Mwoch together with the use of the extra buffering added in 2.7.2aX it will
probably even out ;) Win some lose some.

> And it's my inability to get grammars right from the first time that makes
> me ANTLR them several times before having something to compile ;-) Or maybe
> it's because those damned temporary files were making the Ant unit tests to
> fail from time to time, and it took us two days to figure what's happening
> :-))

It sometimes makes you wonder if a pencil and paper is more advanced than a
computer :) And we poor software developers are basically only outthere
frustrating ourselves (and eachother) ;)

> Anyway, I can live with it as default behavior.

We'll see what Terence cooks up with the new codegeneration stuff. And see
if we can squirrel setting a different printwriter away in it.


    ---- Ric Klaren ----- klaren at cs.utwente.nl ----- +31 53 4893722  ----
 'And this 'rebooting' business? Give it a good kicking, do you?' 'Oh, no,
  of course, we ... that is ... well, yes, in fact,' said Ponder. 'Adrian
    goes round the back and ... er ... prods it with his foot. But in a
     technical way,' he added. --- From: Hogfather by Terry Pratchett.


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

More information about the antlr-interest mailing list