"Transformational grammar", developed by Noam Chomsky in the 1950's, is a close match for the the parsing style used by the long-departed code author. Maybe the programmer was a linguist?
In fact I wouldn't blame the original author, in the absence of knowledge that there was a body of theory giving other efficient approaches, for implementing a parser in that basically transformational style. I'd done so myself a few years earlier, when I thought I'd try implementing an expression evaluator with no prior reading just to see whether I could.
It's all the details that were wrong. If he'd only started by lexing the expression into a list of atoms and operators – in fact, preferably a linked list, for ease of changing length – then he wouldn't have had to keep shifting entire strings back and forth all the time...
http://en.wikipedia.org/wiki/Transformational_grammar
In fact I wouldn't blame the original author, in the absence of knowledge that there was a body of theory giving other efficient approaches, for implementing a parser in that basically transformational style. I'd done so myself a few years earlier, when I thought I'd try implementing an expression evaluator with no prior reading just to see whether I could.
It's all the details that were wrong. If he'd only started by lexing the expression into a list of atoms and operators – in fact, preferably a linked list, for ease of changing length – then he wouldn't have had to keep shifting entire strings back and forth all the time...