Cliff Hacks Things.

Sunday, October 22, 2006

propasm, the Propeller Assembler

I've released propasm, my assembler for the Parallax Propeller eight-core microcontroller. Unlike the Parallax-provided assembler, it:

  • Runs on practically anything;

  • Can be automated from scripts or Makefiles;

  • Provides really good feedback;

  • Supports characters outside of US English;

  • Is written in Java;

  • Will be open-sourced shortly.

This was an interesting project for me, because it involved a number of separate areas of my brain. This was my first hand-written traditional parser; I've written plenty of parsers before, but this one is broken into a traditional scanner/lexer and recursive-descent parser. Since I was writing the parser by hand, I was able to make the error messages clear and specific — something generated parsers often lack.

I also had to reverse-engineer the binary format and parts of the instruction set, as Parallax's documentation on both is spotty.

Since it's in Java, rather than x86 assembler (like Parallax's), it's somewhat slower. It takes all of 10ms to load, parse, wire, and write out a decent-sized program.

...of course, to use Parallax's, I have to boot Windows, start an IDE, open my text file, and click four times in a menu. I think propasm wins overall. :-)

Update: I'm already on my first point release; I'd made an error on the I/O code that caused UTF-8 to be mangled on some platforms. Fortunately, my test case using ウーロン茶 as a variable name failed. If only I'd had the tests written when I released... :-)


Post a Comment

<< Home