[antlr-interest] pretty printing in the c target

Jim Idle jimi at temporal-wave.com
Tue Dec 16 11:09:33 PST 2008


On Mon, 15 Dec 2008 23:35:11 -0800, Gavin Lambert <ANTLR at mirality.co.nz>  
wrote:

> At 15:37 16/12/2008, Jim Idle wrote:
>  >You don't do that, you just let the factory take care of
>  >it all. When you close, it has trcked all the mmemory and
>  >it frees it all for you. You just use teh strings and forget
>  >about them as if they were Java objects. Use the factory in
>  >the parser (see C examples for poly for instance), and you
>  >don't even need to close your own factory.
>
> What if you've got lots of temporary strings though (or a big input  
> file)?  Wouldn't the memory usage add up quickly?
>

Depends how you use it, but of course this isn't the most efficient way.

That is why it is only a convenience thing and if you have megabytes of  
text to build up and cannot afford the memory space then you should use  
the tokens and extract the strings yourself.

To be honest though, my experience has been that it is relatively small  
beer for an average size program.

Jim



More information about the antlr-interest mailing list