Implemented parsing and pretty-printing for queries