且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我必须在哪里开始构建编译器?

更新时间:2023-09-15 23:24:52

当你问到从哪里开始我可以推荐这一系列文章来自Crenshaw [ ^ ]



至于语言 - 你真正喜欢的任何东西......当天'C'编译器是用'C'编写的!



这个 SO发布 [ ^ ]被关闭为没有建设性但确实有一些适合您的问题的建议



Edi t - 上面的SO帖子现已被删除 - 这是一个类似的帖子 [ ^ ]
As you asked where to start I can recommend this series of articles from Crenshaw[^]

As to language - anything you like really ... back in the day the 'C' compiler was written in 'C' !

This SO Post[^] was closed as "not constructive" but does have some suggestions that would be appropriate for your question

Edit - the above SO post has now been removed - here is a similar one[^]


编写编译器是一项复杂的任务,编写 C ++ 编译器是一项令人生畏的任务。

我建议你选择一种更简单的目标语言来开始。你可能需要一些关于这个论点的背景知识(你可以从已经建议的Creenshaw系列开始,或者看看老兄的Wirth的书:编译器构造 [ ^ ],或着名的'龙书' [ ^ ])。

您也可以考虑使用一个用于编写编译器的许多可用工具,例如 flex [ ^ ]和野牛 [ ^ ], ANTLR [ ^ ]等...
Writing a compiler is a complex task, writing a C++ compiler is a daunting task.
I would suggest you to choose a much more simple target language for starting. You probably need some background on the argument (you might start with the already suggested Creenshaw series, or check out the oldie goldie Wirth's book: "Compiler Contruction"[^], or the famous 'Dragon Book'[^]).
You may also consider using one of the many available tools for writing a compiler, e.g. flex[^] and bison[^], ANTLR[^], etc...


有不同的互联网上的开源编译器,但我赞成 LLVM ,因为它是一个新的和现代的开始,现在在XCode IDE中很有效率Apple-世界。它摇滚;-)



考虑开发一些开源项目,而不是开始一些。
There are different open source compilers in the internet, but I would favour the LLVM, because it is a fresh and modern start, which is now productive in the XCode IDE of the Apple- world. And it rocks ;-)

Consider working on some open source project instead of starting some.