views:

79

answers:

3

I need to write parser for some specific language (subset of SQL). As I know, the easiest way to do this is to define grammar in BNF and use yacc-like tool (I have positive experience with GPPG). But when I started, I've realized that these tools produce parser with dependency on some core parser assemblies (e.g. ShiftReduceParser.dll for GPPG). I need to implement parser for Silverilght, so I can't use libs targeted to full framework.

Are there any parser generator tools which can be used in/for Silverilght?

+3  A: 

I don't know what framework libraries you're allowed to use in Silverlight, but Coco/R seems pretty light-weight, just needing some stream/text processing from System.IO and System.Text.

Dario
Thanks, looks like it fits all my needs
altso
A: 

Do you need the parser to run inside Silverlight? Can you not instead get the Server to handle that function via WCF or other transport? That way you can use code that you have prior experience with to perform the parsing.

AnthonyWJones
Yes, I can use server side parsing, but client side is more preferable.
altso
A: 

You might want to try a library like ANTLR. Here's an article that shows how to use it for SQL parsing.

Rene Schulte
Thanks for your suggestion, but if I understand documentation (http://www.antlr.org/wiki/display/ANTLR3/Antlr+3+CSharp+Target) correctly, parser generated with ANTLR require Antlr3.Runtime.dll and Antlr3.Utility.dll. So, I can't use it with Silverlight.
altso