An ANTLR4 grammar for T-SQL
This is a community supported grammar file for t-sql, it is cool, yet not very complete so far because a grammar reference of T-SQL is hard to find. MS website has grammar reference for different statements, but it's not a complete file, so we try hard to stick to the references we could find, and bit by bit make it a more complete grammar.
The reference for the Adaptive Server Enterprise variant of TSql is online.
Usage, important note
As SQL grammar are normally not case sensitive but this grammar implementation is, you must use a custom character stream that converts all characters to uppercase before sending them to the lexer.
You could find more information here with implementations for various target languages.