> This, on the contrary, would slow things down a bit, since a few function objects would have to be created each time a rule is parsed.

However, accessing them as local variables is faster than accessing them as globals. It's hard to predict performance without testing it. However, what you've done now (three top level functions) looks fine to me.