Utilities for writing template engines