Use lex/yacc for parsing database

This removes previous dependency on `stdext` and makes for a more functional bootstrapping.