Files
turso/vendored/sqlite3-parser
Jussi Saurio eec7c0529c Merge 'Beginnings of AUTOVACUUM' from Zaid Humayun
This PR adds the beginnings of
[AUTOVACUUM](https://www.sqlite.org/lang_vacuum.html) to Limbo. It adds
a feature flag called `omit_autovacuum` which is analogous to
`SQLITE_OMIT_AUTOVACUUM`. It is off by default, same as SQLite.
It introduces the concept of [pointer map pages](https://www.sqlite.org/
fileformat.html#pointer_map_or_ptrmap_pages) which are reverse index
pages used to map pages to their parents. This is used to swap pages
(when a table is deleted for instance) to keep root pages clustered at
the beginning of the file. It's also used while creating a table to
ensure that root pages are clustered at the beginning (although, this
isn't completely implemented yet)
Finally, it also adds a couple of missing instructions like `Int64` that
are required for `PRAGMA` commands related to `auto_vacuum` settings
<img width="1512" alt="Screenshot 2025-05-28 at 8 47 51 PM"
src="https://github.com/user-
attachments/assets/d52eb74f-5b79-4d52-9401-1bdc2dcc304d" />

Closes #1600
2025-06-09 08:20:24 +03:00
..
2024-11-16 20:08:59 +02:00
2025-02-12 17:28:04 +02:00
2025-02-12 17:28:04 +02:00
2024-11-16 20:08:59 +02:00
2024-11-16 20:08:59 +02:00
2024-11-16 20:08:59 +02:00
2024-11-16 20:08:59 +02:00
2024-11-16 20:08:59 +02:00
2024-11-16 20:08:59 +02: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 July 2024.

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.

Minimum supported Rust version (MSRV)

Latest stable Rust version at the time of release. It might compile with older versions.