Skip to content

Support disk caching and save/load for Earley parsers - #1696

Open
Aschenbath wants to merge 1 commit into
lark-parser:masterfrom
Aschenbath:feat/earley-disk-cache-1348
Open

Aschenbath wants to merge 1 commit into
lark-parser:masterfrom
Aschenbath:feat/earley-disk-cache-1348

Conversation

@Aschenbath

Copy link
Copy Markdown

Earley parsers can now use the existing cache=True/filename and save()/load() interfaces. The cache preserves grammar analysis and rebuilds runtime matchers and callbacks on load, avoiding repeated GrammarAnalyzer work while retaining lexer, ambiguity and tree options.

Fixes #1348.

Validation: full suites pass on Windows/Python 3.12 and Linux/Python 3.11 (1,343 tests each, 148 skipped), and Linux/Python 3.10 including Nearley (1,351 tests, 148 skipped). The 14 new test methods cover cached reloads, save/load, lexer and ambiguity modes, nullable grammars, priorities, callbacks, postlex changes and different process hash seeds. Mypy and pre-commit pass. Documentation HTML builds, with the same 23 diagnostics as unchanged master; strict warning-free build does not pass on either version.

Implemented, tested and reviewed with Codex; no human review is claimed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement cache for earley parser

1 participant