4 ms·
After grokking the tokenisation, parsing and eval of lisp like languages, what's the next step up? I usually have a bit of fun mocking out a language I'd like
by jwdunne 9y ago
After grokking the tokenisation, parsing and eval of lisp like languages, what's the next step up?
I usually have a bit of fun mocking out a language I'd like but end up getting into details like type systems. I never really get to expressing as a CFG.
I'm wondering if the best course is to say right, keys now build a small, procedural language or some kind of barely typed C lookalike as the best step up?
- mietek 9y agoWhy not give Pierce’s “Types and programming languages” a spin?
- cardiffspaceman 9y agoI agree, for sufficiently large values of step. This book could change your life. But I think the C4 self-hosted C compiler (discussed at [1]) might be another next step in a different direction. [1] https://news.ycombinator.com/item?id=8558822 https://news.ycombinator.com/item?id=8558822
- jwdunne 9y agoThis intuitively makes a lot of sense. The short variable names with the legend at the top makes it a little harder to understand but you can see what's going on from a macroscopic view. Perhaps translating this to another language with clearer variable names would be a good exercise for me.
- jwdunne 9y agoI've been working through this book. It's difficult to get through, I'll admit, at my stage. Is there anything you'd recommend as a supplement?
- Sohcahtoa82 9y agoTry making an interpreter for a simple language like QBASIC.
- mhh__ 9y agoAt a glance, you could make a very unsafe not-really C without too much thought. I probably wouldn't make it too C like, just so I could avoid worrying about parsing etc. As to type systems, that's a completely different can of worms (One which I do not have much expertise in). Type systems can range from the simple e.g C to the formal study of type systems (e.g. Hindley-Milner). Personally, I don't really know the formal side very well (I can't recall details from memory the same way I can with (say) Lagrangian mechanics), so I can't recommend one particular book.
- simplify 9y agoI found these resources invaluable when implementing my first type system: - Understanding Hindley-Milner http://akgupta.ca/blog/2013/05/14/so-you-still-dont-understand-hindley-milner/ http://akgupta.ca/blog/2013/05/14/so-you-still-dont-understa... - Implementing a basic type system http://cs.brown.edu/courses/cs173/2012/book/types.html http://cs.brown.edu/courses/cs173/2012/book/types.html
- jwdunne 9y agoThat first link was awesome. The notation can be intimidating but this article has defogged it. Thank you! I'm gonna check out the next article and return to the first. Deserves a second reading.