I'm working on a new language and while writting the grammar I'd like to be able to test the grammar for completeness, conflicts and similar. I'm not really concern about the underlaying parser generator (but one for .NET would be preferrable)
So feature list in short would be:
A CodePlex project called Irony does have something simlar to what I'm asking for but does not support writing the grammar as BNF which is required.
I would recommend ANTLR as a parser generator. It's very feature complete and supports C# as well as a host of other target languages.
For IDEs, there's a plugin for Eclipse called ANTLR IDE and a standalone IDE called ANTLRWorks, both of which work well.
Note, however, that ANTLR uses an LL(*) algorithm instead of a LR(k) algorithm. Still, it's very nice and ANTLRWorks can do most of the necessary left factoring.
When "working on a new language" and trying to get a reference BNF right, you probably don't want to bias your reference grammar towards any particular parser generator. One of the troubles with writing a test grammar for Bison (LALR(1)) or ANTLR(LL*) is you do just exactly that. You also don't want to get hung up in "how do I code the BNF rules in such a way as make it actually parse" presumably because you are interested in working on the grammar, not working on the parser generator.
So I'd recommend using a full context free parser generator. This will let you write the grammar in the most natural form with the least effort. This might mean giving up "text editor", "editor test window", ... but in my experience (check my stack overflow bio) using a context free parser generator overwhelms those niceties completely. Edit-save-parse just doesn't take a lot of effort.
I understand Bison has a GLR option which would provide context-free parser generation, and is open source, and so it might do for just the testing out the grammar.
Our DMS Software Reengineering Toolkit is commercial and also provides a GLR parser, which has been used to implement some 30+ full langauges including C, C++, and COBOL in a number of dialects as well as more modern languages such as Python, Ruby, PHP, ....
The difference between DMS and Bison is that DMS is designed to support all aspects of the construction of a full language analyzer/translator (Unicode lexing, GLR parsing with error reporting and recovery, automatic tree construction, symbol table construction, control and data flow analysis, transformations, prettyprinting, ...). If you wanted to seriously evaluate your "new langauge", you'll eventually need to do all this stuff, and Bison is only a tiny step along this road. DMS will carry you the whole way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With