Refactoring scanner, parser, and type generator