Show HN: Learning Project: building an imperative language

36 points by bergsans ↗ HN
Hi! I am doing a learning project, attempting to build an imperative language (and interpreter). The end product will be useless for others, I just want to learn and better understand how to build imperative languages. :) If someone else shares this interest and want to give some good hints on good resources I would be grateful. Currently I am looking at an awesome text by Bob Nystrom. All suggestions and tips on resources are most welcome. I am very much a beginner in this, but I find this topic very fascinating. Mail me or post links here! Cheers!

You can try a beta version Online at https://herebeseaswines.net/crudelang/.

GitHub: https://github.com/bergsans/crudelang

11 comments

[ 2.7 ms ] story [ 17.7 ms ] thread
I think you've already found the best resource out there.

For fun I'm making a language that's a superset of Lox and Monkey, the language from the book by Thorsten Ball.

> The end product will be useless for others

I like your honesty!

Well, it looks like you've got something working so you've accomplished your goal, where do you feel you are falling short?

Also there are a ton of good tutorials out there I assume, have you not found any? (not checked as I don't need them, but it's the interweb so...)

Might not be exactly what you want but the pay-what-you-can (free to read) online book Beautiful Racket[0] is an amazing resource for learning how to build languages. In the words of Alan Kay, "Lisp isn't a language, it's a building material".

The last project is implementing an extended version of BASIC that supports interop with Racket, so as imperative as it gets.

[0] https://beautifulracket.com/

> The last project is implementing an extended version of BASIC

Thanks! This sounds very interesting! Cheers!

Always cool to see people experimenting with languages! I'm doing a similar thing with wheel-lang [0], which started as pretty purely imperative, but is starting to grow some object-oriented features.

Nystrom's Crafting Interpreters is a great resource; I've also liked Compiling to Assembly From Scratch [1] and Write You a Haskell [2].

[0] https://github.com/DylanSp/wheel-lang/

[1] https://keleshev.com/compiling-to-assembly-from-scratch/

[2] http://dev.stephendiehl.com/fun/

Cool! And I hope as well learn a lot (from building wheel-lang)! Thanks for the links!