Rewrite generator and tokenizer