Javascript in Javascript in a Wiki

I'd been playing around with interpreting Javascript in Javascript, building off the Narcissus interpreter. Then I implemented some sucky pseudo code and that got me thinking about algorithm visualisation and how to improve pseudo-code on the web. In an interactive medium there really is little reason why algorithms should still be presented as static text.

So I rewrote the Javascript interpreter in continuation-passing style, so that it's execution could be paused. And the result is Javascript code that runs in the browser but can be controlled and visualised. Code that a user can pause and step through to see the control flow. The interpreter is currently passing 95% of the ECMAScript Language test262 test suite.

On top of the Javascript interpreter I built an experimental wiki to explore making algorithms interactive on the web. There are still lots of things to do and to figure out (eg. security), but I think it is very promising.

I also mangled it with the WebKit inspector to produce a Javascript IDE, although it's a bit rough and buggy.

I'm very curious to hear what people think, and any suggestions.

More info:

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Looking good! This may be interesting for you:

Have you seen this talk by Bret Victor?

The whole presentation is well worth watching, but the part starting at about 16:30 seems especially relevant for you.

In short, it's about visualizing what an algorithm does *while* you're writing it, so you get immediate feedback while you type.

Given what you've already got, would this take a lot of extra effort to implement? It would be very cool.

Thanks, I hadn't seen it

Thanks, I hadn't seen the talk. I like a lot of the ideas Bret has about immediacy.

It wouldn't be *too* hard to implement something similar, showing assignments next to lines of code. It looks like a fun idea, but I always wonder about how these things scale.

The next thing I'd love to implement would be a reversible debugger, with a slider so you can step or scrub back and forth through the execution of the algorithm.