Rewrite semantic analysis