The PostgreSQL parser is available as a C library.
C - https://github.com/lfittl/libpg_query
Ruby - https://github.com/lfittl/pg_query
Go - https://github.com/lfittl/pg_query_go
C - https://github.com/lfittl/libpg_query
Ruby - https://github.com/lfittl/pg_query
Go - https://github.com/lfittl/pg_query_go
That said, the tool being discussed here (pev) is used to interpret EXPLAIN plans, which libpg_query doesn't give you, as its only concerned with the parsing stage, not the planning stage.
In order to plan a query you'll need more information from the actual database, including table statistics, config settings and the size of the underlying table :)
Never-before-on-the-HN-front-page tools for working with PostgreSQL queries seemed relevant to me; this info may help a few others.