Hacker News new | past | comments | ask | show | jobs | submit login
A Z-Machine in OCaml (2016) (ericlippert.com)
64 points by tosh 53 days ago | hide | past | web | favorite | 4 comments



Incidentally, the execution model and abstract machine for OCaml (more accurately Caml Light) is based on Xavier Leroy's paper "The ZINC experiment: an economical implementation of the ML language" [1] - an all time CS classic. Reading that paper and the surprisingly approachable source code for OCaml's interpreter [2] is a great way to demystify functional compilers.

[1] https://caml.inria.fr/pub/papers/xleroy-zinc.pdf

[2] https://github.com/ocaml/ocaml/blob/trunk/runtime/interp.c


This is an excellent series from one of my favorite technical bloggers. It is one of the most accessible introductions to a language I've encountered. It is also a great introductions to creating a VM. Highly recommend for anyone that is curious about OCaml or how older adventure games worked.


While it's true the Z-Machine predated the CLR and JVM by a long time, but similar virtual machines as a general concept predates the Z-Machine by a long time as well.

BCPL "O-code" dates to 1966. Pascal P-code, from the early 70's was better known, being a major part in Pascals early success, and popularized in particular with UCSD Pascal from the late 70's.

I don't know to what extent the Infocom developers were aware of those forerunners, but it seems likely. I don't know if either of those forerunners supported paging though.


I remember following this a while back while working on my implementation of the z-machine. I don't think he finished it though ( neither have I! )




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

Search: