implemented caching for tr and regex

Changed tr to make set separately (for caching).
Split out lexer into separate package to avoid import cycles (because
pest uses it)