Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can also implement an interpreter in Haskell/ML without using closures to implement closures. It would still be a lot less painful than C.


Of course. But it's still reasonable to ask how you'd write a compiler that implements such features in a free-standing way, without depending on either the built-in tools of the language you're writing an interpreter in or a black box run-time environment/VM that does all the tricky stuff for you by magic. With a relatively low-level language like C, you don't have any choice but to confront such issues head-on, while many tutorials manage to side-step them using higher-level languages. Of course it's easier to write almost anything in a suitable higher-level language, but for educational purposes that isn't really the point IMHO.


In that case, why not write a compiler in Haskell to C ;-)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: