Live data from Hacker News

Ask HN: Resources for building a programming language?

news.ycombinator.com

71–80 of 87 posts

Re: Ask HN: Resources for building a programming language?

#71
Robert Harper's book Practical Foundations for Programming Languages (free draft) http://www.cs.cmu.edu/~rwh/pfpl.html

This book will stop you from making easy mistakes in design of whatever DSL or language you're trying to create. Also see the commentary he keeps on it which changes often http://www.cs.cmu.edu/~rwh/pfpl/commentary.pdf

Re: Ask HN: Resources for building a programming language?

#72

I'd probably start by using Racket (Racket is a scheme is a lisp) which has a whole toolkit for language building. Arc is written this way, for instance. Often these are lispy languages but there is no reason they have to be. A starting point: http://beautifulracket.com/stacker/ or https://www.hashcollision.org/brainfudge/ That will get you started rediculously quickly and give you things like GC and JIT for free. Yo…

Also note that Racket is a very fun language :)

Re: Ask HN: Resources for building a programming language?

#73

I'd probably start by using Racket (Racket is a scheme is a lisp) which has a whole toolkit for language building. Arc is written this way, for instance. Often these are lispy languages but there is no reason they have to be. A starting point: http://beautifulracket.com/stacker/ or https://www.hashcollision.org/brainfudge/ That will get you started rediculously quickly and give you things like GC and JIT for free. Yo…

Another one for that list is Hackett, a promising language in development that I'm following closely. It too piggybacks on Racket and aims to bring together the best features of Haskell and of Lispiness.

https://lexi-lambda.github.io/blog/2017/08/28/hackett-progre...

Re: Ask HN: Resources for building a programming language?

#74

Earlier quoted context omitted.

The first edition of EOPL was eye opening. I learned what a continuation was, (and how to do CPS) from it. The second and third editions feel less "hard core" somehow.

Do the later editions have less content? Would your recommendation be to read the first edition? Thanks!

(strictly imo) the 2nd and 3d editions are fine books and cover a lot of material, but they don't have as much (for lack of a better word) depth as the first edition. If you can get the first edition, it is certainly worth reading.

Re: Ask HN: Resources for building a programming language?

#75

Earlier quoted context omitted.

I came into Forth with 32 years of mixed experience from Lisp, Smalltalk, Haskell, C++, C, Java, Perl, Python, Clojure, Scala and more; it's difficult for me to judge anything from that perspective. I've never written a standard Forth program in my life though, never installed any other implementation. The second I was introduced to Forth, it clicked; Lisp took me much, much longer to get by comparison. Like I said,…

Thanks for the reply. I'll take a look. When you said it clicked. What we're you looking at? Starting or Thinking Forth or what? I'm trying to find out how most people learn to build their own system.

It was a random blog post praising the simplicity of Forth; couldn't find it again if my life depended on it. Thankfully it didn't go too much into Forth dogmatics; what it did instead was to cut the ideas down to their core, which simplified my thought process to the point where I could finally see a clear path to something that felt like it was worth my effort.

We over-complicate things, for different reasons. The truth is that nothing is very complicated once you understand it well enough to break it down to its core.

Re: Ask HN: Resources for building a programming language?

#76

Earlier quoted context omitted.

Do the later editions have less content? Would your recommendation be to read the first edition? Thanks!

(strictly imo) the 2nd and 3d editions are fine books and cover a lot of material, but they don't have as much (for lack of a better word) depth as the first edition. If you can get the first edition, it is certainly worth reading.

I worked through most of the first edition (skipping much of the OO chapter) and read the later editions pretty lightly. They're more polished and developed, e.g. explaining better code for the CPS transform, adding a chapter on types, and such. But they do give me a bit of a spoon-fed vibe compared to the first edition, I guess as a result of optimizing it from classroom feedback. I'm not sure depth is the right characterization of the difference -- I didn't get that impression, besides the compiling chapter getting dropped. But then I didn't study them as much (though I did report an erratum in the second edition).

Re: Ask HN: Resources for building a programming language?

#77

I've really been enjoying http://www.craftinginterpreters.com/ unfortunately it isn't complete yet.

I've been recommending this to co-workers who want to learn how to write their own language. I had ideas on how I would write a book on compilers and Bob had all the same idea, but he actually went ahead and acted on them. 1. Avoid long discussions on the theory of parsing, how to transform regular expressions into table-driven DFAs, how to build an LR(1) parser, etc.. These topics can be interesting later on, but fo…

You might also like my article https://codewords.recurse.com/issues/seven/dragon-taming-wit... -- it's one chapter instead of a whole book, but it does follow your points 2 and 4. (Not 1 because it just uses Python's built-in parser to ASTs, and not 3 because it's just one compiler.)

I'm looking forward to Crafting Interpreters too.

Re: Ask HN: Resources for building a programming language?

#78
post #18

I recommend playing a bit with ometa: http://www.tinlizzie.org/ometa-js/#Sample_Project The framework has since evolved into ohm, but I think ometa-js is more fun for playing around with. https://github.com/harc/ohm

The Ohm interactive editor is a lot of fun as well - you get real time feedback on examples as you edit your grammar.

https://ohmlang.github.io/editor/

Re: Ask HN: Resources for building a programming language?

#79

Earlier quoted context omitted.

(strictly imo) the 2nd and 3d editions are fine books and cover a lot of material, but they don't have as much (for lack of a better word) depth as the first edition. If you can get the first edition, it is certainly worth reading.

I worked through most of the first edition (skipping much of the OO chapter) and read the later editions pretty lightly. They're more polished and developed, e.g. explaining better code for the CPS transform, adding a chapter on types, and such. But they do give me a bit of a spoon-fed vibe compared to the first edition, I guess as a result of optimizing it from classroom feedback. I'm not sure depth is the right cha…

From this review: http://eli.thegreenplace.net/2017/book-review-essentials-of-...

The book doesn't seem that great for self-study. Would you confirm or reject that assessment?

Post reply on HN