(WIP) Refactor error handling and typed AST representation.