我们什么时候使用ANTLR

问题描述:

任何人都可以请指导我在ASP.Net,C#项目中使用ANTLR的dll的目的。

Can anyone please guide me the purpose of using ANTLR dlls in a ASP.Net, C# project.

我只注意到的 antlr.runtime Antlr3.Runtime Antlr3.Utlility 的组件在一些项目中被引用。

I just noticed antlr.runtime, Antlr3.Runtime, Antlr3.Utlility assemblies being referenced in some project.

将是巨大的,如果能举一些真实世界的例子,或到网页的任何链接将是有益的。

Will be great if can cite some real world examples or any link to a web page will be useful.

您会,如果您解析需要这些dll的使用ANTLR语法在运行时的任何文字。

You would need these dll's if you are parsing any text at runtime using an antlr grammar.

通常有两个步骤。

1)运行Java ANTLR解析器在你.G文件生成一个C#词法分析器,C#语法和可能的C#树步行者。

1) run the java antlr parser over your .g files to generate a C# lexer, C# grammar and possibly C# tree walkers.

2)建立这些文件到您的应用程序。这些文件将与antlr.runtime DLL,或者如果你使用ANTLR版本3 antlr3.runtime DLL一起工作。

2) Build those files into your application. Those files will work in conjunction with the antlr.runtime dll, or antlr3.runtime dll if you're using ANTLR version 3.

您C#程序现在可以解析文本文件使用您在步骤1编译语法。

Your C# program can now parse text files using the grammar that you compiled in step 1.