I want to use ANTLR4 as a compiler for my project (Generator of Documentation), because it seems to me the best of all compilers I have tested. I want to parse a C# code, but I have not found any grammar for ANTLR4. I do not want to use ANTLR3.2 because it is so laborious to write target code to the grammar for the functionality of my generator and I have also written the Visitor which should make the functionality.
The problem is, that the grammar for ANTLR 3.2 downloaded here:
http://antlrcsharp.codeplex.com/ is not compatible with ANTLR4 even when I modified it (I have eliminate syntax errors and warnings). The parser makes error nodes of type Type_declarationContext with NoViableException. I do not know why it want to make everything type_declaration context even if the code does not begin with one of these tokens: class, struct, delegate, enum or interface. Have a look at the picture from debug: In a simple code with one class_declaration, it makes four more Type_declarationContext - which belongs to syntax rule type_declaration, but there should be for example property_declaration inside the class_declaration.
Does anyone know how to update the grammar to be compatible with ANLTR4?
Here You can have a look on my project, where I have done some work on the C# grammar from the codeplex... It is easy to use. I will be so happy if anyone solve the bug and update the C# grammar for ANTLR4.
Thank You very much!
Petr Kloza