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

> Surely something Python-like in C would be more rewarding, one would be gaining a level of abstraction.

That's the second half of the book.



My apologies, that does indeed seem like a reasonable way of doing it.


Also, I should note that even in the first half of the book, the language isn't Java-like. It has Java-ish syntax, but the semantics are much closer to JavaScript/Python/Lua.

In the first half, what we gain from implementing it in Java is mostly the garbage collector. The rest of the static and runtime semantics basically have to be implemented from scratch on top of the JVM.


There is significance coverage of OOP features, hence my Java-like comment. I would have personally left OOP out for a beginner book, it isn't really fundamental. Another advantage to using Java in the first half, could be to use Java closures to implement Lox closures.


> I would have personally left OOP out for a beginner book, it isn't really fundamental.

This was a deliberate choice. Most intro compiler/interpreter books don't do OOP. But most languages in wide use today are object oriented. That felt like a significant gap to me. One of the main goals with my book is to give people insight on how the languages they actually use work under the hood. Skipping objects and method dispatch would limit that.




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

Search: