[antlr-interest] Why (or why not) reuse parsers and lexers?
    Chris Lambrou 
    chris at lambrou.net
       
    Thu Feb  5 02:27:03 PST 2009
    
    
  
Hi all,
Is there any reason why I should consider recycling lexers and parsers in
preference to creating new instances on demand?
For example, should I consider doing this:
    existingLexer.Reser();
    existingLexer.CharStream = charStream;
instead of this:
    new MyGrammarLexer(charStream);
And should I do this:
    existingParser.Reset();
    existingParser.TokenStream = tokenStream
instead of this:
    new MyGrammarParser(tokenStream)
Are parsers and lexers especially heavyweight at all?  If the answer depends
on the context, then I should point out that I'm using the C# runtime, and
parsing many different input strings.
Thanks,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090205/5e34c8a0/attachment.html 
    
    
More information about the antlr-interest
mailing list