如何使用编辑器实现C编译器? [英] How do I implement a C compiler with a editor?

查看:97
本文介绍了如何使用编辑器实现C编译器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为C编写了语法并使用ANTLR生成了词法分析器和解析器程序。解析器和词法分析器程序在JAVA中。

如何构建抽象语法树?是替代方法吗?优点和缺点?

下一步是代码生成,我打算在彻底扫描汇编级语言之后做。我如何解决将所有上述模块作为一个工作单元相关的问题?

I have written the grammar for C and have generated lexer and parser programs using ANTLR.The parser and lexer programs are in JAVA.
How do I approach the construction of an Abstract syntax tree?What are the alternative approaches? Pros and cons?
The next step is code generation which I intend to do after a thorough sweep of assembly level language.How do I tackle the problem associated with bringing all the above said modules as one working unit?

推荐答案

您可以在ANTLR作者的书中找到问题的答案:最终的ANTLR 4参考 [ ^ ]。
You may find answers to your questions reading the ANTLR author's book: "The Definitive ANTLR 4 Reference"[^].


这篇关于如何使用编辑器实现C编译器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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