我们什么时候使用ANTLR [英] When do we use ANTLR

查看:365
本文介绍了我们什么时候使用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.

这篇关于我们什么时候使用ANTLR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆