#incremental #parsing #sql


SQL grammar for the tree-sitter parsing library

1 unstable release

0.0.2 Jun 5, 2021
0.0.1 Jun 5, 2021

#154 in Parser tooling

MIT license

12K SLoC

C 11K SLoC JavaScript 338 SLoC // 0.0% comments Scheme 43 SLoC Rust 31 SLoC // 0.5% comments

Node.js CI

SQL syntax for tree-sitter

This project initially focuses on PostgreSQL flavor of SQL


File describing grammar is grammar.js

Every time the grammar file changes code generation needs to be run by invoking npm run gen

npm test command automatically performs code generation

Tests files are located in test/corpus

Here is the documentation on test file syntax

Running tests

npm install --also=dev
npm test


  • npm run parse <file.sql> outputs a syntax tree
  • npm run extract-error <file.sql> shows first offending line


~52K SLoC