Many parts of this are clearly autogenerated, but that in no way diminishes the sickening impressiveness of it!
It does make it a little hard to understand how the parser/ast_builder works.
But the rest seems easy enough to understand.
Yes! The main parser and emitter come from a BNF parser generator, also written in portable shell (to be released though).
It would be far more interesting to look at what this was "compiled" from; it looks like the output of a state-machine generator.