5 ms·
Ask HN: What are the best books on creating a programming language?
- steve_g 11y agoProgramming Language Pragmatics by Michael Scott http://www.amazon.com/Programming-Language-Pragmatics-Third-Edition/dp/0123745144 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.
- sdegutis 11y agoHuh. 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).
- sparkie 11y agoThe implementation of functional programming languages by Peyton-Jones. Engineering a compiler by Cooper and Torczon.
- sova 11y agoLearn 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.
- sdegutis 11y agoThanks 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.
- e19293001 11y agoThe 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.
- e19293001 11y agoCompiler 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.
- rjbwork 11y agoThis will get you started on the compilers side of things. http://www.amazon.com/Compilers-Principles-Techniques-Tools-2nd/dp/0321486811 http://www.amazon.com/Compilers-Principles-Techniques-Tools-... You can also use http://lmgtfy.com/?q=sicp http://lmgtfy.com/?q=sicp for a deeper understanding of interpreted languages and language structure.
- code_chimp 11y agoYou 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.
- sitkack 11y agointernational 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_used?ie=UTF8&condition=used http://www.amazon.com/gp/offer-listing/0201100886/ref=dp_olp...
- paulddraper 11y agoThat's not my experience. I usually find then to be cheaper, in paperback, and sometimes with different exercise problems.
- sitkack 11y agoCool. 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.
- sdegutis 11y agoThe 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?
- Ace17 11y agoFor 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-to-write-your-own-language/240165488 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.
- sdegutis 11y agoThe 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.
- woolybully 11y agoWell, 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.