Moving

We are moving this weekend to our new place in Richmond. We will not have land-line telephone service for a week, so if you need us you will need to call one of our cell phone numbers.

We will also not have internet for a week, so email may be sporadic.

Rocket Staging

Well, the past week has been pretty eventful; we sold our 650-square-foot condo and have bought a 1400-square-foot townhouse in Richmond, BC. And we’re moving in just over 3 weeks, so the craziness is like to continue.

I’ve even been too busy to note last Saturday’s SpaceX launch and subsequent failure of their 3rd Falcon 1 rocket. Turns out that the new engine they were testing burned a little longer than they expected after shutdown, and the first stage bumped into the second stage after they separated. Which is disappointing, but an easy fix — just separate a bit later after main engine cutoff.

There’s even a video, which is pretty darn cool.

SpaceX say that they might launch another rocket in a month or so. I’m a huge space geek, so of course I’m hoping that the fourth time will be the charm.

Parsing Expression Grammars and Left Recursion

Parsing Expression Grammars are a form of context-free grammars with ordered choice. This reduces ambiguity in the grammar and makes writing simple recursive-descent parsers (and parser generators) quite easy. With memoization, you can parse in linear time. The resulting parser is called a Packrat Parser.

The only problem is handling left-recursion. If you have grammar rules like this:

Expression = Expression "+" Term
           | Term

your recursive-descent parser will recurse until it runs out of stack.

I just noticed a paper on detecting and handling left-recursion: Packrat Parsers can Handle Left Recursion. It’s a nifty technique, but it somewhat reduces the simplicity of the resulting program.

For a finger exercise a while ago I wrote a pretty basic packrat parser generator and used it to implement a C preprocessor. Source is here. When my supply of circular tuits increases I’ll have to look at implementing the stuff from the paper.

Ooh, the drama

So I thought that my life for the next month would be all work.

I was walking home last night in the gloaming, when I heard someone crying out. I looked up from the rather silly Australian thriller I was reading. An elderly lady had fallen down and gone boom. I walked over to see blood everywhere from a superfical cut in the lady’s forehead, but there didn’t seem to be any major issues. Another passerby got there just before me and called 911, so I stood around trying to look supportive. Then I managed the demanding and probably superfluous job of flagging down the ambulance that arrived quite quickly.