sort fields in the generated AST