[antlr-interest] Lexer/Parser invocation
Micheal J
open.zone at virgin.net
Mon Jan 31 16:40:33 PST 2005
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org
> [mailto:antlr-interest-bounces at antlr.org] On Behalf Of
> Bharath Sundararaman
> Sent: 31 January 2005 21:30
> To: ANTLR Interest
> Subject: [antlr-interest] Lexer/Parser invocation
>
>
> Hi all,
>
> I am using ANTLR as my CC tool and I have a routine that
> passes source code as a string to my compiler. The question
> is, if I did not want to create instances of the lexer/parser
> every single time I pass a string, how would I do it?
<SNIP>
> Any ideas?
In C# you can use the resetState() methods thus:
lexer.resetState(streamOrString);
parser.resetState();
parser.topRule();
The implementation of the resetState() methods in C# should tell you all you
need to know.
Alternatively, the ANTLR 2.8experimental release has inbuilt
resetState()-like support for all langauges. It currently uses methods named
reset() however. See Loring's earlier post about when it might be available.
Micheal
ANTLR/C#
More information about the antlr-interest
mailing list