工作如果是和编译器相关的或者编译器爱好者们,谁没有点冲动想自己写个编译器出来。我也做了一些调研,分享如下:
–介绍如何使用JAVA语言完成一个面向LLVM后端的编译器,以mjava作为目标语言,这是JAVA语言的一个子集。包括词法分析,语法分析,错误控制,符号表管理,类型检查等部分
–采用一种逐步增加功能的方式构造编译器,作者的文章写的很深入前出(我只看了abstract和introduction部分)
–作者从1988-1995年用了7年的时间完成了这份介绍。没有使用flex和yacc这些东西,纯手工制作。使用pascal语言写出的编译器。是一位学物理的博士,很是钦佩!
MIT OCW 6.035 Computer Language EngineeringMIT关于计算机工程的开放课程,使用JAVA语言创建一个完整的Decaf语言编译器。我也曾看过一点,但这门课的实验要求有MIT的环境,还有一些库什么的。外面的人拿不到,所以没办法,只能作参考了。
–编译器课程,使用C++实现一个Cool(Classroom Object-Oriented Language)语言编译器.也是因为没有缓环境和库,只能作罢。
– 很有特色的一门课,也是使用C++实现COOL语言的编译器,但将LLVM融入进来,前端输出中间表示到LLVM,在作一些后端的实验。另外UIUC还有一门高级的编译器课程,是使用JAVA语言来编写。重要的是这个CS426 能够下到所有课程的资料,包括源码。 感兴趣的朋友可以试试。
– 这个系列的文章主张使用现有的工具体验如何实现编译器。注重快速高效的实现,主要关注前端。有兴趣了解和学习LLVM 中间表示和工作机制的朋友不要错过。
还有如下的参考资料(¶ Link to a PDF, $ Link to a printed book):
- A Nanopass Framework for Compiler Education ¶
- Advanced Compiler Design and Implementation
- An Incremental Approach to Compiler Construction ¶
- ANTLR 3.x Video Tutorial
- Building a Parrot Compiler
- Compiler Basics
- Compiler Construction ¶
- Compiler Design and Construction
- Crafting a Compiler with C $
- Dragon Book $ – Widely considered “the book” for compiler writing.
- Essentials of Programming Languages
- Flipcode Article Archive
- Game Scripting Mastery $
- How to build a virtual machine from scratch in C# ¶
- Implementing Functional Languages
- Interpreter pattern (described in Design Patterns $) specifies a way to evaluate sentences in a language
- Language Implementation Patterns: Create Your Own Domain-Specific and General Programming Languages
- Lets Build a Compiler – The PDF ¶ version
- Linkers and Loaders $ (Google Books)
- Lisp in Small Pieces (LiSP) $
- LLVM Tutorial
- Modern Compiler Implementation in ML $ – There is a Java $ and C $ version as well – widly considered a very good book
- Object-Oriented Compiler Construction
- Parrot Tutorial
- Parsing Techniques – A Practical Guide
- Project Oberon ¶ – Look at chapter 13
- Programming a Personal Computer $
- Programing Languages: Application and Interpretation
- Rabbit: A Compiler for Scheme
- Reflections on Trusting Trust – a quick guide
- Roll Your Own Compiler for the .NET framework a quick toturial form MSDN
- Structure and Interpretation of Computer Programs
- Types and Programming Languages
- Want to Write a Compiler? – a quick guide
- Writing a Compiler in Ruby Bottom Up
两个新闻组,可以上去请教问题:
想起某人在饭桌上曾经的感慨,I have a dream…..
一直以来,都觉得编译器高深莫测。做个编译器出来,或许很难,但做了可能就不能。 可能是勇气不足。再等等吧,总有一天我要把它实现!。。。。。。。

这里有人像一起搞编译器吗? 不是自己写,是基于clang做一个OpenCL的前端,大家相互学习。
我以前搞过2年的llvm后端。
我现在是做shader compiler的,谁有兴趣可以和我联系联系。
用自己的语言写了一段程序,能否讲讲怎样使用clang和llvm将自己的程序编译为可执行文件?谢谢
Clang和llvm有自己的汇编器和链接器。这些你应该能从llvm.org上看到吧。
http://code.google.com/p/mead-compiler/
有人写编译器吗?
mead你好,你是要找人和你一起合作完成编译器项目吗?《编译点滴》可以为你发布找人的消息。你能否写个关于你的编译器项目的介绍,我可以贴出来:)
我们是一家MCU设计公司,从事8/32位MCU设计,需要系统结构和编译器设计人员,能否帮忙找一下?
工作地点:上海
能否给我一个职位描述,我可以贴在博客上。另外,中科院计算所编译组,今年有7个硕士、四个博士毕业,我也可以把JD发给他们:)
happy new year to all of you
@work and travel, Thank you, And Best wishes to you too.
似乎现在llvm很主流了
@donghao, 恩学术上看,差不多是这样。编译器方向的顶级期刊PLDI今年就3篇与LLVM有关的文章。gcc已经几十年了,open64也十年了。这些编译器中的技术大家都嚼烂了,所以就LLVM图新鲜。不过个人认为目前来看,要性能还是Open64,稳定可靠还是gcc。
@erlv, 嗯,受教了 :)