[antlr-interest] reuse() methos in 3.4 C runtime
Ruslan Zasukhin
ruslan_zasukhin at valentina-db.com
Thu Nov 17 12:21:00 PST 2011
On 6/24/11 7:49 PM, "Jim Idle" <jimi at temporal-wave.com> wrote:
Hi Jim,
I will send few letters now, but I will start with simple question to this
your letter.
Am I right, that we also in this loop should kill and create again
TreeParser?
Yes?
> Because the documentation is not yet up to date, here is an example of
> reusing the allocated memory in input streams and token streams:
>
>
>
> for (i=0; i<iterations; i++)
> {
> // Run the parser.
> //
> psr->start(psr);
>
> // --------------------------------------
> // Now reset everything for the next run.
> // Order of calls is important.
>
> // Input stream can now be reused
> //
> input->reuse(input, sourceCode, sourceLen, sourceName);
>
> // Reset the common token stream so that it will reuse its resources
> //
> tstream->reset(tstream);
>
> // Reset the lexer (new function generated by antlr now)
> //
> lxr->reset(lxr);
>
> // Reset the parser (new function generated by antlr now)
> //
> psr->reset(psr);
> }
--
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