Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: What are the best books on creating a programming language?
20 points by _vya7 on Dec 5, 2015 | hide | past | favorite | 18 comments


Compiler Construction Using Java, JavaCC, and Yacc, IEEE/Wiley, 2012

This book taught me how to create compilers. The author started from simple principles in grammars then slowly introducing a very simple compiler eventually adding more features to the compiler. I was able to adapt his method in developing a compiler. In later chapters, the book does a great job in presenting an application of what was learned from the previous chapters by implementing grep using automata theory.


Programming Language Pragmatics by Michael Scott

http://www.amazon.com/Programming-Language-Pragmatics-Third-...

I haven't read a lot of language books, but this one has good information on the various design choices one might make when building a language. Like the others listed in the comments, it's more implementation-focused than semantic design-focused.


Huh. This is the only book recommended so far that only has good Amazon reviews. I think it may be a winner. But honestly it's so hard to judge a book by its cover, or even by Amazon reviews (even though some of them seem to make really good points).


Well, there's designing a pl and there's implementing a pl, and many other subquestions as well. For implementation, yes, the Dragon book is fundamental, but also look at other points of view, such as packrat parsing, or non-textual syntax. For design, wow, hmm, does the world need another programming language? If you're thinking of an OO language, look at the design space of OO languages, for example, is inheritance class-based or prototype-based. if you're looking outside OO languages, look at the crazy menagerie of languages that have been created so far: APL, Plankalkul, Toontalk.


For the actual implementation of a compiler (not design of the language itself), I'd recommend "Modern Compiler Design" by Dick Grune. A lot more practical and readable than the Dragon Book.

About the language design itself, you might want to have a look to: http://www.drdobbs.com/architecture-and-design/so-you-want-t... These are very interesting guidelines from Walter Bright, the man behind the D programming language.


The Amazon reviews on Modern Compiler Design aren't very favorable towards it. Same for the Dragon books (all editions). I'm not sure what to make of this.


This will get you started on the compilers side of things.

http://www.amazon.com/Compilers-Principles-Techniques-Tools-...

You can also use http://lmgtfy.com/?q=sicp for a deeper understanding of interpreted languages and language structure.


The dragon book is mentioned often, but usually only as "this book covers these things," which isn't really a recommendation, only a comment. Is the book actually good? Can you recommend it?


Yes, it is a great book. Trust me. If you are scared by the lexing and parsing algorithms, skip them because it is highly unlikely you will write them on your own. You don't need to refer to other sources to implement your own language with it.


It is good. I had a dated copy, but a lot of what it talked about was still applicable to learning how to implement a basic programming language.


You can usually find an International Edition of the dragon book on eBay for around 25 USD. The cover may be different, but the content is the same.


international editions are printed on horrible paper and often have mistakes for who knows what reason. I would steer clear of them for the most part.

The first edition can be had for $10 on amazon. http://www.amazon.com/gp/offer-listing/0201100886/ref=dp_olp...


That's not my experience.

I usually find then to be cheaper, in paperback, and sometimes with different exercise problems.


Cool. I'll take another look. I got burned a couple times buying books on half dot com that were being resold from India. Quality was horrid.


Learn Lisp. Or the more modern equivalent: Clojure. I think learning a LISP-like language will make programming at its core that much more clear, and the potential for a DSL (domain specific [programming] language) that much more relevant.


Thanks for the tip. I've been doing Clojure full time for about 4 years now, so I think I've got a good head-start. Now I'm looking for something that will help me understand stacks in virtual machines and how to generate bytecode for them from an AST, that kind of thing.


The book that I've recommend will also help you understand what you mentioned. I had a great time going through the book, enjoyed a lot and learned a lot. Really.


The implementation of functional programming languages by Peyton-Jones.

Engineering a compiler by Cooper and Torczon.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: