Create Your Own Programming Language (Book)
createyourproglang.com
createyourproglang.com
The blurb says
"Become the next Guido Van Rossum, Matz, Larry Wall or Rasmus Lerdorf by creating your own revolutionary programming language in a few days"
yeah right! :-D.
If anyone is really interested in learning to build an interpreter or compiler, here is a book list to work through in order.
(1) SICP (do all the exercises in Chapter 4 and Chapter 5). There is an incredible amount of learning there. Once you've done this, you can write a basic interpreter/compiler for languages with s-expression syntax. [The semantics can be anything you imagine]
(2) Essentials of Programming Languages. This will teach you how many language features work (lazy evaluation, object systems, static type systems ..)
(3) Lisp in Small Pieces - how to implement byte code compilers, macro systems, compilation to C, lots of good stuff here.
(4) A book on lexing and parsing so you can give your language any syntax you want. I prefer Modern Compiler Design by Gries. If you understand the first three chapters you can write your own lex/yacc equivalents. (the book has a lot more to it than these chapters, but it is the best I've seen on lexing/parsing).
(5) Now take a look at the source of your favorite language. ((Lua and the lcc compiler (it even has a book explaining its design) in particular, are very educational).
(6) If you are REALLY serious about optimization, Steve Muchnick's book, Advanced Compiler Design and Implementation.
I have all these books and have derived an incredible amount of learning and joy from them.
yes it is a bit of work, but it is fascinating journey. Enjoy.
EDIT: If you want to go deep into type systems (say you want to grok Haskell's type system from first principles, (or add OCAML like modules to your language, say) Benjamin Pierce's Types and Programming Languages - You are in good shape to work through this after you've finished EOPL
yes I have this too. But I haven't worked through it so I didn't want to reccomend it blindly. Many talented hackers(e.g Peter Norvig) say good things about this book so I am sure it is great. The language it uses (Oz) is a bit flaky wrt syntax but VERY powerful.
Another recent lovely book, though a bit on the formal side is Gifford and Turbak'S Design Concepts In programming languages. (Another 1000 + pages !! - the road to compiler gurudom has many 1000 page books to work through!).I am working though this and I am enjoying it thoroughly. I hope to finish it by the end of this year.
CTM is good, it covers a lot of theory of programming techniques and IMHO a must read for anybody interested in programming language design. Oz syntax is a bit quirky and weird, but the language seems to be quite powerful and very flexible, supporting many varied types of programming. I have not read all of it yet, but most - not exactly light reading :-)
I will definitely check out the other books which you mentioned though.
You are welcome! I had to work through some really awful books before I put all the pieces together and stumbled onto the good books.
Even most good books omit some crucial piece (E.g EOPL , as good as it is, doesn't say anything about how to write a garbage collector/memory management infrastructure, SICP doesn't deal with lexing/parsing or type checking and so on.)
It covers declarative programming, functional programming, several concurrency models, logic programming, object-oriented programming, dataflow programming, and probably a half dozen things I'm forgetting. The book uses Oz* , with major asides using Haskell, Erlang, Java, Prolog, and probably a couple others.
There's a draft PDF floating around, but if you like it, I'd highly recommend buying the book. (Same with SICP.)
* Which seems like an interesting language, though I've never gotten it to build on OpenBSD, so I've done exercises in OCaml, Lua, or Scheme instead.
Sure, language design is a deep field, with lots of subtlety and complexity. And people spend years studying it. That doesn't mean that every language requires a huge tome of background to implement.
Sure reccomending someone work through SICP chapters 4 and 5 (enough to write an ultra simple compiler/interpreter) is "snobbery". ;-)
So be it. :-P
That doesn't mean this book (referred to in the original posting) isn't a scam. It is.
Any reccomendation on the internet (including mine) is worth only the electrons it consumes. Caveat Emptor!
I've worked through the books I reccomended (and was careful not to reccomend great books like CTM which I have no experience of).
This is the best way I know how to get this knowledge. I am not claiming it is the most efficient method. feel free to provide better paths.
If that strikes you as "snobbery" , bleh to you ;-)
I stand by that. Design in any endeavor can't be learned from books, small or big. Before you can "design" you need the nuts and bolts skill to implement your designs.
The books I reccomended, if sincerely worked through, give you the nuts and bolts knowledge to implement the designs you do conceive. Reading through the source of languages you admire, will teach you a lot (I reccomended that too).
Since I never said you could learn language design (vs learning how to build interpreters and compilers - I started my reccomendation list with "If anyone is really interested in learning to build an interpreter or compiler, ..." -) by working though books, I fail to see what you are reacting against?
I maintain that a 44 page book (particularly this one which is an outright scam) doesn't have the space to cover even the basic implementation techniques, leave alone "design".
Please provide counter examples of such "small books" that teach "language design" if you disagree. One counter example is worth a lot of internet debate!
The shortest introduction I know capable of turning you into an interprter/compiler writer is Chapters 4 and 5 of SICP (and there is a lot of stuff in the previous 3 chapters that lead to these chapters).
Also, _Modern Compiler Implementation in ML_ by Andrew Appel (http://www.cs.princeton.edu/~appel/modern/ml/) is quite good. It uses SML, but is pretty understandable if you're familiar with OCaml or (perhaps) Haskell. I found it vastly more readable than the Dragon Book.
I love when people create small books, video tutorials about complex subjects. They are an introductory peek at what is cool about a complex subject. Then you have the opportunity to learn more about the parts the interested you, rather than buying "Modern Compiler Design" and realizing you have no interest in writing your own lexer or parser.
Not to say the books/sites you recommend aren't great, they are just overkill.
You can't "bootstrap a language quickly" using open Source tools unless you already know what you are doing.
Learning how to build a decent language (leave alone an "enterprise ready" whatever that is) language does take more than a few days. Promises to make you the next Matz and Guido "in a few weeks" is outright fraud.
"rather than buying "Modern Compiler Design" and realizing you have no interest in writing your own lexer or parser."
It is obvious you haven't read the book before making this comment. MCD teaches you how grammars and grammer processors work.
Without understanding this you can't use lex/yacc etc properly. Being able to build your own lex/yacc type tools is a bonus.
"they are just overkill."
if you think EOPL, an undergrad text focusing directly on the core of your language interpreter (hint, lexing and parsing are not the core) is "overkill", I have nothing to say to you!
Good Luck with the "build a revolutionary programming language in 21 days" approach!
Coming up next, "Build an Operating System in 21 days and become the next Linus Torvalds!"
;-)
It's not a book that'll teach you how to actually do any of this stuff. It's an overview, a gloss, an extended Wikipedia entry in guide form, that shows you the work that goes into creating a programming language. It's like the show "How It's Made." If, at the end, you think you actually want to write a programming language, then by all means, read your set of books. (That's not to say that this was their goal--it was probably a stupid attempt to actually let people design and implement a language after reading one book--but this is what you should take away from it, and a perspective from which reading the book would be useful.)
It is basically a really high level overview of a whole bunch of stuff from EE/CS, from logic gates through VM design through compilers (and sort of OSes, but not really). Each chapter is a project and build on each other (but you can actually do them in any order).
It isn't as in depth as many of these other books, but might be an easier first book.
Any tips on improving the copywriting or anything are greatly appreciated!
My other gripe is with the price. $40 seems high for a 44-page document. I'd buy it if the price was lower.
BTW - thanks for Thin! Because I know your name and work the content came off as sarcasm to me at first, but I could definitely see how someone without this prior knowledge might think it's a scam. Best of luck with this book; it does truly look cool.
I'd like to see more details. Your sample chapter on Lexers, for example, would be much stronger if you went into more details (maybe 3-4 pages) on how a scanner identifies a token, how it knows when it has reached the end of a word, how it recognizes and handles whitespace, why it's important to keep track of indentation and newlines, what is the difference between keywords and other identifiers, etc. Maybe also give a written explanation describing what each section of your lexer for Awesome is doing.
Please consider this as constructive criticism: I think the book is a good idea, but I also think it needs more meat. I don't know how easy it is to revise it at this time, but I think you'd have better luck if you added more details.
a little?
"Become the next Guido Van Rossum, Matz, Larry Wall or Rasmus Lerdorf by creating your own revolutionary programming language in a few days"
Heh heh!
Is this a sign of the times? (See also: http://perl6.org). Sure there's nothing wrong with dressing tech up and making it look fun, but at some point it becomes a turn-off, which is a shame. 2600 et al did not need fancy fonts and bright colors to appeal to hackers.
tl;dr - get off my lawn!
A lot of what surrounds it sounds way too much like a mix of spam and infomercial for my taste. Then again, I am most likely not the intended audience. I must say it makes me smile seeing this marketed as a "cool thing" tough.
Creating programming languages is not difficult but designing good programming languages is.
But I mean, if it is a walkthrough then for people interested in the JVM it could be useful.
While learning how to use ASM you will also learn about the instruction set of the JVM. It also includes a disassembler that, given a .class file, outputs the java code necessary to generate that class using ASM.
That's an interesting observation, touching on the education discussion - that the bottleneck in advancing individual learning/human knowledge questions is still that of finding someone who knows the answer. Universities provide one solution by creating a "critical mass" of smart people nearby that you can go to for advice. And although maybe my academic network is lacking, I couldn't quite get the same quality of advice reaching out personally as what you gave. StackOverflow and news.YC help [1], but didn't quite give me the solution I was looking for either (until now).
If I was convinced I could consistently good advice from a service, I'd pay well for it - upwards of a thousand dollars a year, I'd imagine.
To do this, I am not reading a 44 page PDF to tell me everything I need to know, instead I'm reading thousands of pages of material(1), I've been prototyping code, talking to people and reading a lot of Lambda the Ultimate discussions. You just can't learn all the fundamental concepts, all the theory and the practical details (language and implementation/compiler/vm) from 44 pages...
1: Some of the stuff I've been reading especially for this: Concepts, Techniques and Models of Computer Programming - 930 pages of fundamental programming language theory. Structure and Interpretation of Computer Programs - 657 pages of Scheme goodness. Advanced Topics in Dataflow Computing and Multithreading - 460 pages of research. Countless SIGPLAN papers. God knows how many web pages and random PDF's.
And thats just the theory, I've yet to get reading the actual COMPILER books. Near the top of my list is the dragon book - another 1000 pages.
Creating a language that's actually good for something is a very different sort of challenge...
Coffee all over keyboard! Damn you!! :-D
Hilarious! Upvoted! Now to clean that spilt coffee!
Edit: it looks like a good website but I'm still skeptical.
However, if you are looking at books to learn HOW to create a new language you likely haven't answered a more important question: WHY.
* The JVM is awesome. But there are lots of "hosted languages" already on that platform that likely will suit most peoples' needs.
http://steve-yegge.blogspot.com/2007/06/rich-programmer-food...
Impress your employer and peers with a résumé that says: I created my own programming language.
That's why ;-)
That way you at least get something useful out of the exercise.
(Ducks)