开发者

Where to start if I want to understand how compilers and programming languages are made [duplicate]

开发者 https://www.devze.com 2023-03-13 01:02 出处:网络
This question already has answers here:开发者_开发问答 Closed 11 years ago. Possible Duplicate: Learning to write a compiler
This question already has answers here: 开发者_开发问答 Closed 11 years ago.

Possible Duplicate:

Learning to write a compiler

I know this is a broad question to ask, but where could I start learning how compilers actually work, how programming languages are made, I mean not how you use Java or Ruby but how people actually are making them. I will not try to replicate these languages in any ways but I want to understand the concepts and theory behind it. So what I need is either some directions on what I should search for, or even better and more appriciated are book recommendations.

Regards,

Jonathan Nash.


You might find Lets Build a Compiler by by Jack Crenshaw an interesting introduction.

Kept very simple and focussed on building actual functionality.


  • Compiler Constrution by Niklaus Wirth is pretty good and available for free from the link I provided (yes, legally). It's a bit old and uses Oberon for the examples but is easy to follow.

  • Create Your Own Programming Language by Marc-André Cournoyer is available online for USD 40 and consists of an eBook (including exercises and solutions), source code for two example languages (one in Ruby and one in Java) and a screencast on extending the JVM based language. This is probably the most newbie-friendly introduction you can find on the topic and afterwards you should have a pretty good idea about the steps involved (tokenizing, parsing, lexing etc.) and can continue your research with the provided links. It's a bit expensive, but IMHO it's worth it.

  • While not primarily a learning resource, the CoffeeScript web site has a section called "Annotated Source", which is really helpful in seeing how a programming language works. CoffeeScript's author started working on it after he read the book I mentioned in the previous bullet point btw.


You could take a look at the Dragon Book:

  • Compilers: Principles, Techniques and Tools by Aho, Lam, Sethi and Ullman


I've greatly enjoyed Language Implementation Patterns and learned a bunch. I wish I had read it before trying to implement a DSL some years ago.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号