I'm going to do something with loljs

Published April 28, 2013

loljs is a pretty rubbish LOLCODE to JavaScript translator I hacked together a few years ago before I really knew JavaScript. It really is rubbish, half the time it will crash on bad input and give absolutely no indication that it has done so. But according to traffic stats, people love it.

It hit the big time (sort of) after a (relatively) popular YouTube channel video used it for a "how to learn programming video".

lolcode is not a sensible way to learn to program. But it strikes me that it is a sensible way to learn some things about programming languages. lolcode has the nice pair of properties that it's powerful enough to express normal programming constructs while being small enough to be able to keep the whole language's structure in your head at once. It's also amusing.

I would like to relaunch loljs as:

  1. A more robust compiler/runtime.
  2. A well featured text editor.
  3. Something to visualise the relationship between the lolcode and the way a compiler sees it.

I have started writing the compiler using Jison, instead of the rubbish and buggy hand-written parser I had before. I am currently working down the route of interpreting the resulting tree instead of translating it to JS, as this gives a bit more runtime control and better error feedback. It's also easier and more fun than messing around with creating strings of JavaScript code and having to worry about how safe they are and how we figure out relaying runtime errors back to the user.

For the text editor I'll probably use CodeMirror and write a custom mode.

The third point needs more thought. I like the idea of being able to hover over blocks of code and see some representation of the syntax tree for that fragment. The first version will probably just show some nicely formatted JSON, but I wonder if something clever could be done with Canvas to display a real, explorable tree.

I am only working on this in my free time, so it might take a while.

Filed under: javascript, lolcode, loljs, programming

Talk is cheap

Leave a comment:

HTML is not valid. Use:
[url=http://www.google.com]Google[/url] [b]bold[/b] [i]italics[/i] [u]underline[/u] [code]code[/code]
'