如何在 Windows 和 VS 2010 上开始使用 ANTLR 生成 C

发布于 2025-01-07 04:36:24 字数 287 浏览 3 评论 0原文

我在网上搜索了一段时间,但没有找到任何关于如何使用 Visual Studio 2010 在 Windows 环境中启动 ANTLR 的好信息。我的目标是 ANTLR 的 C 输出选项。

因此,我正在寻找一个很好的教程/介绍如何在 Windows 上开始使用 ANTLR,例如生成 *.c 和 *.h 文件并创建一个小型 VS2010 C 项目,该项目遍历由 ANTLR 生成的抽象语法树(AST) ANTLR 文件并将其打印到控制台。

任何关于好的教程/介绍的提示都会对我非常有帮助!

提前致谢! 再见,乔纳斯

I searched the web for while but did not found any good information how to start with ANTLR in a Windows environment using Visual Studio 2010. I target the C output option of ANTLR.

Thus, I am looking for a good tutorial/introduction how to get started with ANTLR on Windows, e.g. generate the *.c and *.h files and create a small VS2010 C project which walks the abstract syntrax tree (AST) produced by the ANTLR files and print it out to the console.

Any hints to a good tutorial/introduction would be very helpful for me!

Thanks in advance!
Bye, Jonas

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

温折酒 2025-01-14 04:36:24

这是您第一次学习 ANTLR 还是您至少在 Java 中使用过它?

由于 ANTLR 以 Java 为中心,我个人建议您首先在 Java/Eclipse 环境中学习它,以确保您了解 ABC。

http://javadude.com/articles/antlr3xtut/

然后你可以了解它的VS集成。我个人使用 ANTLR MSBuild 目标,它是 ANTLR C# 运行时的一部分,用于根据 ANTLR 语法生成 C# 文件。您可以轻松地对 C 执行相同操作。

Is this the first time you learn ANTLR or you have at least used it for Java?

As ANTLR is Java centric, I personally suggest you learn it in Java/Eclipse environment first to make sure that you know the ABCs.

http://javadude.com/articles/antlr3xtut/

Then you can learn about its VS integration. Personally I use the ANTLR MSBuild targets, which is part of ANTLR C# runtime to generate C# files from ANTLR grammar. You can easily do the same for C.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文