Missing classes in Antlr.Runtime for C #

I am trying to get Antlr to work using NuGet.

The current version of Antlr.Runtime.dll that I am trying to use is 3.1.3.42154.

The problem is that when I try to create my LexX and Parser.cs files, I get a lot of build errors regarding missing types.

eg. Class GrammarRuleAttribute not found. I look in Antlr.Runtime.dll, but there is no class. However, if you look at the Antlr project on GitHub , then you can see that GrammarRuleAttribute really should be in the Antlr.Runtime.dll file.

Is this a mistake or am I missing something?

+4
source share
2 answers

This is somewhat time sensitive Q / A, because the C # goals for ANTLR (CSharp2 by Johannes Luber and CSharp3) change over time. I know that the goal of CSharp2 has recently been related to some issues. Starting with this entry, the current version of the CSharp3 target is 3.3.1.

Here is a link to the CSharp3 target documentation , which includes several links to download the ANTLR tool to the C # port, CSharp3 runtime, MSBuild support, and some tools for Visual Studio. I periodically update this document when new versions are released.

Edit: If you encounter display problems or exception messages when opening the grammar file, you must remove the ANTLR 3, StringTemplate, and Extensibility Framework extensions from the extension manager and reinstall them according to the instructions in the related documentation. I updated the extensions to solve the problem.

+4
source

I had this problem when using CSharp2 or CSharp3. I am creating ANTLRWorks 1.5rc1.

It turned out that this is due to the version of ANTLR. I installed the official package using NuGet, which was 3.1.x. After uninstalling this and installing an uninstalled package 3.4.1, it worked.

My test grammar still had a slight problem with the HIDDEN channel. Changing it to Hidden (as defined in Antlr3.Runtime) resolved the issue

0
source

Source: https://habr.com/ru/post/1340762/


All Articles