Tuesday, February 14, 2012

Yet another Kernel interpreter

I wrote another Kernel-ish interpreter in JavaScript: Virtua.

This time, no tail-call optimization or first-class continuations, just plain old pedestrian control flow: LOOP, CATCH, THROW, UNWIND-PROTECT (unexpectedly, this didn't make the interpreter much smaller than the one with TCO and continuations.)

Probably the only interesting thing in there is that everything is fully OOP: EVAL is a message, as is COMBINE, as is MATCH - which means every object can potentially control its own evaluation, act as a combiner, and be used as a left-hand-side pattern in matching.

Again: Kernel is nice and elegant, but the interpretetive overhead of fexprs is killer [Edit: haven't measured it, and see this]. Maybe it doesn't matter for what I want to do: script web GUIs.

2 comments:

  1. I like what you are doing with kernel, and I would give a useful comment, if I was able.

    but I would like to hear your thoughts on julia, the new language announced today, on hn, reddit, ltu. it's at julialang.org

    ReplyDelete
  2. I didn't realize you were the one to submit to ltu.

    Damn.

    ReplyDelete

Real names (or handles), please. Anonymous comments are likely to be ignored.