My compiler vs. the monkeys

In high school I took part in a computer science fair in my hometown of Pittsburgh. It was city-wide, with folks from schools all over the area participating. The judging was held at Monroeville Mall. (The same mall where 'Night of the Living Dead' was shot, btw :)

My entry was a compiler for a custom language I had invented, implemented in Apple Pascal. I forget the details of the language, but the thing worked, and produced 6502 assembler as output. The assembler could be transferred to a DOS 3.3 disk and turned into a runnable program with the BIG MAC assembler. The compiler was mostly recursive descent, except for the expression parsing, where I used precedence parsing. Some local dad who had a job as a mainframe programmer had shown me the railroad switching algorithm to parse expressions, and I thought it was incredibly cool, so it got used too even though it wasn't really necessary.

(I saw a chapter on precedence parsing made it into Beautiful Code...about time that technique got some pr.)

Anyway, on the designated Saturday I showed up and set up my Apple II on a table. Only when the judges came by -- who were respresentatives from a local Radio Shack -- did I realize that my demo was a little lacking. Watching a compiler run is not very exiting, and the cumbersome process to move the intermediate output code over to DOS where it could be assembled and run didn't help. The judges were baffled by what I had done -- it wasn't clear they knew what a compiler was -- and my mumbled explanations didn't help. They moved on.

Later I learned that a program that animated some monkeys on a screen had won the competition.

My buddy didn't fare much better. He had implemented some kind of font-rendering system for his Epson MX-80 dot matrix printer. Had hand-designed all sorts of new fonts for it too, kerning, crazy stuff, it was some kind of proto apple II postscripty-thing. Frankly I was mystified by his project but it seemed like an awful amount of work and rather impressive. I felt better that he hadn't won either.

TechCrunch40 certainly got a ton of press, and looks like it was a huge success for Michael and Jason. And folks I know who went said it was actually a pretty good conference, with interesting sessions, quality attendees, etc.

Back when I was at Scala, I took over maintenance of the core interpreter for the scripts that Scala runs. (The language is unusual, in that it has explicit support for both parallel operations and sequential ops in each code block, in order to better support multiple items animating.) All recursive descent; simple syntax.

One thing that was a mess was the expression parser - it was an ad-hoc design by someone who hadn't really done language design/parsing before. (I'd done a bunch of stuff with Forth back in college and in the early days of the Amiga, plus compiler beta-testing, and writing a Csh-workalike plus a lot of additions.)

I ended up rewriting it largely from scratch (after giving up on fixing it), largely re-inventing the railroad algorithm (so it appears), and generating a tokenized RPN expression that could be evaluated quickly at runtime.