Factoring out top-level function into a separate file, instead of in the
yacc grammar.