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…
Ask HN: Resources for building a programming language?
31–40 of 87 posts
Re: Ask HN: Resources for building a programming language?
#32https://www.destroyallsoftware.com/screencasts/catalog/a-com...
Not free, but his screencasts are excellent, so worth a look if you see a topic that interests you.
Re: Ask HN: Resources for building a programming language?
#33If you're looking to create a dynamic language with reasonable performance, you could look at implementing it with RPython [1], which is used for PyPy, or for the Parrot VM [2], which is used for Perl 6. Once it becomes a little more mature, Zeta VM [3] may also be a good target. [1] https://rpython.readthedocs.io/en/latest/ [2] http://www.parrot.org/ [3] https://github.com/zetavm/zetavm
Re: Ask HN: Resources for building a programming language?
#34I'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…
This archives the state of the system when we made the switch:
https://github.com/brownplt/pyret-lang/releases/tag/pyret-20...
Some things, like the grammar (https://github.com/brownplt/pyret-lang/blob/5f22ec7c8affde15...) have survived largely intact from that prototype for years.
Re: Ask HN: Resources for building a programming language?
#35Using Forth as a substrate lets you focus on the more interesting aspects to an even higher degree than Lisp. The last thing you want is detailed instructions; unless you're just building another whatever, which never really made sense to me. Build the most simple and naive thing possible that works the way you want it to, and go from there. That's how Snabel was born: https://github.com/andreas-gone-wild/snackis/blo…
Edit: It looks like Snabel is a Forth inspired concatenative language written in C++ with some perl like features. That's pretty cool. If you ever get the chance I think I'd enjoy it if you made some video tutorials explaining the design and some of the code choices.
Re: Ask HN: Resources for building a programming language?
#36Understanding Computation by Tom Stuart [0]. While not soley dedicated to creating a language, the first couple of chapters deal with building semantics of a simple language using Ruby as the implementation language (but easily done in any other language you're familiar with). Implementing the virtual-machine the language runs upon in a language you already know provides some really wonderful insights. [0] http://a.c…
Re: Ask HN: Resources for building a programming language?
#37I strongly suggest you build something esoteric and fun first. This should be a "bare minimum" VM or interpreter. Here's one of mine that I wrote like a 8 years ago[1]: https://github.com/dvx/zeded/ Don't start off with YACC/Bison as they hide a lot of stuff under the hood. It's cool learning things from scratch. The most commonly-suggested book on compilers is known as the Dragon Book [2] and if you want to take thi…
Re: Ask HN: Resources for building a programming language?
#38It's really easy so I could build it with coffeescript in just 4 hours while I was a student.
Re: Ask HN: Resources for building a programming language?
#39You'll want the Dragon Book as a reference, not necessary to get started with, but to build the semantic tree on which you will need to pin concepts on. https://www.amazon.com/Compilers-Principles-Techniques-Tools... If you aren't yet committed to any language, you can start building a parser with PyParsing. It's really easy. http://pyparsing.wikispaces.com/ If you want to take a quick (albeit expensive) class on it,…
Hmm. This might be kind of blasphemous, but I think I'd recommend against the dragon book? As I remember, the emphasis in that book is on syntax-directed translation. I might argue that the less you're thinking about syntax and lexing/parsing crap the better. (For that reason: ignore other answers that tell you to learn about a particular parser generator (e.g. ANTLR). That's just fluff.) Really, if you're coming to…
I agree! It's hard to criticize a book rightly regarded as a classic, but I think it solves the wrong problems, or at least emphasizes the wrong areas.
if you design your grammar to be LL(1) you can parse your language using recursive descent
Yep, that's the way to do it.