This is copied directly from https://github.com/youtube/vitess/tree/master/go/vt/sqlparser with just a few modifications to make it work as a standalone repo.
There are, also, modifications to allow it to parse multiple sql statements in a file. As well and an example program sqlfmt that will pretty print sql file provided to it. Or show where the errors in the file are. It will only show the first error.
Unless otherwise noted, the vitess source files are distributed under the BSD-style license found in the LICENSE file.