4 ms·
Show HN: Learning Project: building an imperative language
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
- anonymoushn 6y agoI 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.
- throwaway_pdp09 6y ago> 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...)
- thesephist 6y agoDid this myself with Ink [0] and learned a lot. I also wrote about the experience on my blog [1] with links to resources I found helpful under the "Implementation" heading. [0] https://dotink.co/ https://dotink.co/ [1] https://thesephist.com/posts/pl/ https://thesephist.com/posts/pl/
- bergsans 6y agoCool, will check it out! Thanks. Yeah, you learn a lot from it. :)
- prettyracketta 6y agoMight 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/ https://beautifulracket.com/
- bergsans 6y ago> The last project is implementing an extended version of BASIC Thanks! This sounds very interesting! Cheers!
- DylanSp 6y agoAlways 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/ https://github.com/DylanSp/wheel-lang/ [1] https://keleshev.com/compiling-to-assembly-from-scratch/ https://keleshev.com/compiling-to-assembly-from-scratch/ [2] http://dev.stephendiehl.com/fun/ http://dev.stephendiehl.com/fun/
- inetsee 6y agoThere are other variations for functional programming languages. Lisp [1]. Scheme [2]. Lisp Interpreter written in Python. [1] http://buildyourownlisp.com/ http://buildyourownlisp.com/ [2] https://upload.wikimedia.org/wikipedia/commons/a/aa/Write_Yourself_a_Scheme_in_48_Hours.pdf https://upload.wikimedia.org/wikipedia/commons/a/aa/Write_Yo... [3] https://norvig.com/lispy.html https://norvig.com/lispy.html
- bergsans 6y agoI love Norvigs text. I built a minimalistic lisp (https://github.com/bergsans/one-page-lisp https://github.com/bergsans/one-page-lisp) to learn more after reading the text. Thanks!
- bergsans 6y agoCool! And I hope as well learn a lot (from building wheel-lang)! Thanks for the links!
- krueger71 6y agohttps://craftinginterpreters.com/ https://craftinginterpreters.com/ gets a lot of love