H2D2 running on Linux

Well, I tried running my H2D2 programming language / virtual machine thingy on the Fez Panda II by means of RLP, but I wasn't successful. Alas, the amount of memory left for running native code is not big enough for it. If I was really brave I could use the board as a native ARM development board I think, but I'd rather do other stuff...

Speaking of which, I've gotten round to hacking up a makefile for H2D2 so I can compile it on Linux with GCC. It was easy really, I've just created the simplest makefile you can imagine. But here is my usual victory dance running on Debian Squeeze emulated in VirtualBox:

Which is awesome, and 440 milliseconds is rather quick - especially because it's running in an emulator. I also tried it on the machine I built from an Intel D410PT motherboard and it managed to do it in 400ms flat. These rather unscientific benchmarks seem to indicate that GCC on Linux is more efficient than Pelles C generating code for Windows.

So I guess the only logical step now is to compile it on the Raspberry Pi. It would be rude not to.

Compiling the H2D2 programming language for AVR micros

I've been trying to make my latest attempt at writing a programming language (which I'm currently calling H2D2) as portable as possible. So I decided to try and recompile it for AVR microprocessors using WinAVR. It worked fine with just some very minor tweaks (and the odd bug fix). So here's a simple H2D2 program running on a (simulated) AVR microprocessor:

Specifically, it's a simulated ATmega128 running inside VMLAB. The program just writes out a series of ASCII characters in a loop, like this:

  loop (c=65)
    print c
  repeat (c=c+1 if c<91)

There have also been some more improvements to the syntax, where I'm continuing to draw on DALIS for inspiration. This time round I seem to be making more use of brackets. More things are coming out looking like C functions, which is why we have loop() and repeat(). I'll probably enforce brackets with if() as well I expect.

Currently, the microprocessor is parsing the source code, generating the syntax tree (i.e. compiling to H2D2 bytecode) and then running it in the H2D2 Virtual Machine. It might be better to just have the VM on a microprocessor and somehow get the bytecode onto the device pre-compiled.

But at least this microprocessor example demonstrates that my C code is reasonably portable, hopefully I can keep it like this. In reality running a Virtual Machine on top of a small microprocessor might not be very practical, but I'm just trying to make sure that my code can target other devices really...

I'm tempted to try running this code on my Fez Panda II by means of RLP, which should allow me to run H2D2 as native ARM code (being called from inside the .Net Micro Framework), that might have to be tried out.