[antlr-interest] How to use generated C# parser ?

Ahmed Hamouda ahmedh at horizonssoftware.com
Wed Jan 16 08:29:02 PST 2008


Hi all,

I'm a new user for Antlr parser generation tool, I use AntlrWorks.

I already have writed the language in Antlr and generated the lexer and
parser successfully and now trying to use the generated code.

 

This is the code to use them

 

string strParserTest = "Sum(Process:strTest,lstTest)";

ICharStream cs = new ANTLRStringStream(strParserTest);

KPILexer lexer = new KPILexer(cs);

CommonTokenStream tokens = new CommonTokenStream();

tokens.TokenSource = lexer;

KPIParser parser = new KPIParser(tokens);

 

This is good, but I don't know the next step to use parser to check the
formula against the defined grammar.

In other word, I want to know how to use the parser to check of
correctness of the formula.

 

Any idea will be appreciated.

Thank you for cooperation.

 

Best Regards

 

Ahmed Hamouda (MCTS)

Software Engineer

Horizons Software

Address: 93 Haroun Al Rasheed Street, Heliopolis, Cairo, Egypt. 11351. 

Tel:         +202-2644-3709

Mobile:    +2010-33-55-879

Fax:        +202-2632-0661

Website:   www.horizonssoftware.com <http://www.horizonssoftware.com/> 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080116/a259599b/attachment.html 


More information about the antlr-interest mailing list