precedence-aware prettyprinting