ANTLR-based SQL parser for Java 25 targeting MySQL, PostgreSQL, Oracle, and SQLite.
- Build tool: Gradle
- Target runtime: Java 25
- Current status: Milestone 5 (cross-dialect stabilization) complete; all four dialects (MySQL, SQLite, PostgreSQL, Oracle) have stable parser implementations with cross-dialect conformance tests.
- MySQL
- Real upstream grammar vendored from
antlr/grammars-v4(seesqool-grammar-mysql/UPSTREAM.md). - Parser facade with SLL-first parsing and LL fallback; parser metrics via
ParseMetrics. - Normalized AST:
CREATE TABLE,CREATE DATABASE,DELETE,DROP TABLE/DROP DATABASE, derived tables,GROUP BY,HAVING,INSERT/REPLACE,SELECTwith joins/aliases/expressions,SHOWstatements,TRUNCATE,UNION/UNION ALL,UPDATE, script mode, and more. Unsupported statement kinds fall back toMySqlRawStatement. - Conformance and regression suite in
sqool-conformance; JMH benchmark insqool-bench(vs JSqlParser).
- Real upstream grammar vendored from
- SQLite
- Grammar vendored in
sqool-grammar-sqlite(seeUPSTREAM.md). Parser insqool-dialect-sqlitewith SLL/LL andParseMetrics. - Normalized AST for core SELECT (simple queries without complex expressions), and raw-statement fallback for all other constructs. Cross-dialect conformance tests alongside MySQL, PostgreSQL, and Oracle. JMH benchmark in
sqool-bench.
- Grammar vendored in
- PostgreSQL
- Grammar vendored in
sqool-grammar-postgresql(seeUPSTREAM.md). Parser insqool-dialect-postgresqlwith SLL/LL andParseMetrics. - Normalized AST:
SELECT(including single-table and JOIN queries), with raw-statement fallback for INSERT, UPDATE, DELETE, CREATE TABLE, DROP TABLE, and transaction control. Conformance and JMH benchmark present.
- Grammar vendored in
- Oracle
- SQL-only v1 subset: SELECT (including JOINs), INSERT, UPDATE, DELETE, CREATE TABLE, DROP TABLE, TRUNCATE, transaction control (COMMIT, ROLLBACK, SAVEPOINT). PL/SQL procedural constructs (anonymous blocks, stored procedures, triggers) are explicitly out of scope for v1.
- Grammar written for Oracle SQL v1 in
sqool-grammar-oracle. Uses Oracle-specific types (NUMBER,VARCHAR2,NVARCHAR2,CLOB,BLOB, etc.) and constructs (ROWNUM,ROWID,DUAL,SYSDATE,FETCH FIRST n ROWS ONLY,MINUSset operator). - Parser in
sqool-dialect-oraclewith SLL/LL fallback pattern andParseMetrics. Normalized AST: SELECT (single-table and JOIN queries); all other statements fall back toOracleRawStatement. Conformance suite insqool-conformanceand JMH benchmark insqool-bench. - See Oracle Risk and Scope for scope limitations and risk mitigation details.
See Dialect Coverage Matrix for a full breakdown of supported constructs and normalization level per dialect. Usage examples (parsing each dialect, script mode, inspecting ParseSuccess/ParseFailure) are in the Dialect Coverage Matrix – Usage examples section.
./gradlew build
./gradlew verifyBootstrap
./gradlew :sqool-bench:jmhSee Benchmarks for how to run and capture baseline results.
- SQL Parser Technical Design
- SQL Parser High-Level Implementation Checklist
- Dialect Coverage Matrix
- Diagnostics Behavior
- Benchmarks
- Milestone 0 Bootstrap Backlog
- Milestone 0 Review Checklist
- Milestone 4 Oracle Backlog
- Milestone 4 Review Checklist
- Oracle Risk and Scope
- Milestone 5 Cross-Dialect Backlog
- Milestone 5 Review Checklist
- Post-M5 Roadmap and Follow-ups
- Next Milestone Checklist
- Parser Abstractions (design note)
- Release Readiness
- Milestone 6: Remaining Implementation Plan
- Upstream Grammar Refresh Process