Live data from Hacker News

Ask HN: Resources for building a programming language?

news.ycombinator.com

11–20 of 87 posts

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

#11
https://interpreterbook.com is a pretty good resource to hit the ground running, with unit tests and little magic.

Once you've gone through it, you'll probably want to use the magic tools as they're well tested at this point, and make your life easier. Still, understanding what they're doing for you is a massive boon.

I should note, it uses Go but not in an idiomatic way. Strings instead of using an error type, etc. This is theoretically for the purpose of making it easier to follow along in another language, but I still wasn't a fan of that aspect.

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

#12
I 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 this endeavour seriously, you should really get a copy.

[1] https://code.google.com/archive/p/zeded/

[2] https://www.amazon.com/Compilers-Principles-Techniques-Tools...

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

#13
If 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?

#17
Here's a cool programming language in a live-coding environment that I developed with my interns two summers ago. It enables natural language programming which is great for introducing young kids to computer science.

It is built in Java and uses a recursive descent parser to parse sentences like "draw a red circle at 300, 300", and is well commented because the intention was for advanced students at my education program to be able to easily extend and hack on it.

https://github.com/techlabeducation/pseudocode

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

#19
This is for building a compiler for the language tiny: http://thinkingeek.com/gcc-tiny/

Otherwise, get your hands dirty with a parser generator(PEG parser generators[1] tend to be fairly forgiving). It is pretty easy to get started making an interpreter that way, and it is quick to prototype with.

[1]: http://bford.info/packrat/

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

#20

https://interpreterbook.com is a pretty good resource to hit the ground running, with unit tests and little magic. Once you've gone through it, you'll probably want to use the magic tools as they're well tested at this point, and make your life easier. Still, understanding what they're doing for you is a massive boon. I should note, it uses Go but not in an idiomatic way. Strings instead of using an error type, etc.…

I worked though a bit of this book over the long weekend, I'd recommend this as well
Post reply on HN