CG/SQL is a code generation system for the popular SQLite library that allows developers to write stored procedures in a variant of Transact-SQL (T-SQL) and compile them into C or Lua code that uses SQLite’s C API to do the coded operations. CG/SQL enables engineers to create highly complex stored procedures with very large queries, without the manual code checking that existing methods require.
CG/SQL system also includes features for managing and upgrading schema, creating test code for stored procedures, getting query plans for procedures, as well as interfacing with stored procedures from other languages, such as Java, C#, and Objective-C.
This tree-sitter grammar is automatically generated from the Bison grammar that
specifies CG/SQL. The project and its documentation can be found here.
The script used to to generate the grammar can be found here
with helper scripts in the grammar_utils
subdirectly. The most important part is
tree_sitter.py.
This grammar is MIT-licensed like the rest of CG/SQL.