adding a printer for query expressions - its a debug-only feature - makes it easier to analyze the queries

Not sure we need to make every single thing internal here. @ajcvickers what do you think?