What is the fastest parser generator tool for C# output?

2.5k views Asked by At

I am looking for a parser generator tool which gives C# output and fairly fast. My objective is to parse JSON like text and create CLR object out of it. I used GOLD Parser engine for this but it turned out to be slow for my need. Can anyone please suggest me a good and fast parser generator tool which emits C# code? I heard about Irony and ANTLR but don't have experience with them. Do they generate considerably faster parser or is there any better options?

5

There are 5 answers

1
Saurabh Gokhale On BEST ANSWER

I think you should consider the GPLEX Scanner Generator. This is the fastest one used in the case of lexical specifications that do not require backtracking, and do not have anchored pattern.

Else, you can also go for the SLK Parser Generator ( It supports C,C++,Java,C# languages).

Also be in touch with this question.
It asks about improving th GOLD Parser that you have used : [Improve the GOLD Parser]

1
V M Rakesh On

ANTLR is a LL parser which is less powerful than LR parsers interms of language acceptance. Please verify if your language of context in all possible cases fits in the LL specifications. Also there are some other things to consider like ambiguous grammar, context free or context sensitive grammar .etc... its better to evaluate first your needs with different parser types( LL(+),LR(+), CALR(+), LALR(+) ) available. + means 1 or more occurances of look ahead. After that select one parser generating tool of that parser type.

ANTLR is a LL(k) top-down parser.. good in some cases but not in others as we process recursively on left most derivation. Parsers like gold parser, Visual Parse++ ..etc are LR(k) parsers which are basically bottom-up parsers. with my research on evaluating different parsers we selected LR(k) parser (visual parse++ was good for us) which in general are faster in approach of generating parse tree.

to precise every parsing methodology has its specifications which work good or bad in different cases. We need to evaluate the best one for our language. Also performance of a parser works in two fold for every language you want to develop

1) parsing methodology wrt to the language you are developing. 2) parser generating tool used (tool might not be developed great in some cases)

hope it helps. let me know if i can help with any further information.

V M Rakesh ([email protected])

0
Peter T. LaComb Jr. On

I can't speak to performance, but you could try GPLEX/GPPG

1
Gunter On

The latest version of JSON.NET is able to create dynamic CLR objects directly from JSON. Is that no alternative? Static typed de-/serialization is also possible of course.

JSON.NET

3
Aidiakapi On

Why not use the build in JavaScriptSerializer class to deserialize JSON?

Generic deserialize method: http://msdn.microsoft.com/en-us/library/bb355316.aspx

JavascriptSerializer class: http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx