0
0
mirror of https://github.com/tursodatabase/libsql.git synced 2024-11-23 10:56:17 +00:00
libsql/vendored/sqlite3-parser
2024-08-02 09:26:28 -07:00
..
.github Vendored sqlite3-parser and remove patch 2023-10-27 10:00:54 -04:00
benches bump rust version, fix warnings 2024-07-31 22:47:53 +02:00
sqlparser_bench Vendored sqlite3-parser and remove patch 2023-10-27 10:00:54 -04:00
src bump rust version, fix warnings 2024-07-31 22:47:53 +02:00
tests parser regression tests (#1216) 2024-03-15 09:43:48 +00:00
third_party/lemon remove smallvec from parser (#1580) 2024-07-22 09:56:55 +00:00
.gitignore Vendored sqlite3-parser and remove patch 2023-10-27 10:00:54 -04:00
build.rs Vendored sqlite3-parser and remove patch 2023-10-27 10:00:54 -04:00
Cargo.toml libsql: release v0.5.0 2024-08-02 09:26:28 -07:00
CMakeLists.txt Vendored sqlite3-parser and remove patch 2023-10-27 10:00:54 -04:00
LICENSE Vendored sqlite3-parser and remove patch 2023-10-27 10:00:54 -04:00
README.md Vendored sqlite3-parser and remove patch 2023-10-27 10:00:54 -04:00
Sync.md Vendored sqlite3-parser and remove patch 2023-10-27 10:00:54 -04:00

Build Status Latest Version Docs dependency status

LEMON parser generator modified to generate Rust code.

Lemon source and SQLite3 grammar were last synced as of May 2022.

Unsupported

Unsupported Grammar syntax

  • %token_destructor: Code to execute to destroy token data
  • %default_destructor: Code for the default non-terminal destructor
  • %destructor: Code which executes whenever this symbol is popped from the stack during error processing

https://www.codeproject.com/Articles/1056460/Generating-a-High-Speed-Parser-Part-Lemon https://www.sqlite.org/lemon.html

SQLite

SQLite lexer and SQLite parser have been ported from C to Rust. The parser generates an AST.

Lexer/Parser:

  • Keep track of position (line, column).
  • Streamable (stop at the end of statement).
  • Resumable (restart after the end of statement).

Lexer and parser have been tested with the following scripts:

TODO:

Unsupported by Rust

  • #line directive

API change

  • No ParseAlloc/ParseFree anymore

Features not tested

  • NDEBUG
  • YYNOERRORRECOVERY
  • YYERRORSYMBOL

To be fixed

  • RHS are moved. Maybe it is not a problem if they are always used once. Just add a check in lemon...
  • %extra_argument is not supported.
  • Terminal symbols generated by lemon should be dumped in a specified file.

Raison d'être

  • lemon_rust does the same thing but with an old version of lemon. And it seems not possible to use yystack as a stack because items may be access randomly and the top+1 item can be used.

  • lalrpop would be the perfect alternative but it does not support fallback/streaming (see this issue) and compilation/generation is slow.