[antlr-interest] Is there a safe and easy way to reuse LEXER and PARSER objects on C target?

Ruslan Zasukhin ruslan_zasukhin at valentina-db.com
Wed Apr 20 21:35:40 PDT 2011


On 4/20/11 5:17 PM, "Jim Idle" <jimi at temporal-wave.com> wrote:

> This is available as the reuse() method on the input stream, lexer, and
> parser. 

And tree parser?

> If used then the lexer will also reuse the tokens from the last
> run and avoid any malloc.
> 
> However, you will need to use the snapshot in perforce to get that.
> Or just wait a few weeks for the next release.

I see, thank you Jim.


One more question. After read book and C-target docs,
I did not see section, which describe how works c-target with memory.

In my memory seat words, that C-target have own mempool,
which allow you destroy all objects (tokens, ast) at once.

Reuse()  will destroy not needed objects?


Btw, this is great to have own mempool.
I believe in v2 I have see that tons of destructor calls for each item...
Profiles did show 5-10% for destructors...


-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the antlr-interest mailing list