FR-001checkpassingrewriteScript, rewriteStatement, rewriteQuery, rewriteSource and rewriteExpr MUST rewrite a tree from the leaves up by rules given for the sorts ident, name, expr, query, source and statement: a rule is called for each node that stands in a place of its sort, with the node whose children have already been rewritten, and returns a node of the same sort to replace it or undefined to keep it; a rule's type MUST make a node of another sort not compile, and the result MUST have the type of the sort of the node it was given.