[antlr-interest] Parsing multiple messages using one parser

Jens Stegemann jens.stegemann at gmx.de
Fri Feb 3 10:52:43 PST 2006


Hello,

I am writing a client-server based application in c++ (but the problem will be 
the same in JAVA, too - i suppose). The clients send messages to the server 
which have to be parsed there to create a reply. To do so an 
interpreter-class exists within the server like this one:

class Interpreter
{
	public:
		Interpreter();
		void doParse(string message);
	
	private:
		Parser *myParser;
		Lexer *myLexer;
};

Is it possible to use the same myParser and myLexer objects in every call of 
do Parse(...) and can you tell me how I have to initialize them in the 
constructor and use them in doParse(...) to do so?

My application is working fine when I create new instances of Parser and Lexer 
for each call of doParse(...), but this is much too time-consuming for my 
purpose.

I googled a lot and searched every resource about antlr I could find for a 
solution without success. I hope you can help me.


Your's

Jens

-- 
Keep your dreams alive and live your dreams!


More information about the antlr-interest mailing list