Repository navigation
Conversation
The parser reads lean4export 3.x line by line into the term store and returns the declaration stream of spec 04.7. It checks the input rules of spec 07.1.2. The tests cover each rule, a run of changed inputs that must not panic, and all Arena tests when the Arena directory is present.
Aeneas does not translate a match on byte-string patterns, a match that gives string constants, or the loop state of skip_value. The key lookup now compares bytes in groups by the first byte. The message text is opaque in the extract. The loop body of skip_value is now in two functions.
Owner
Author
|
The
The tests and the subset lint pass. I will merge when |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refers to #2.
This PR adds the lean4export NDJSON 3.x parser of spec 07.1 to
rulean-format. It is stacked on #24, because it writes into the term store.What it does
json.rsis the JSON layer. It reads one object into a table of known keys, and it reads integers, booleans, strings and arrays. It checks every other value for well-formed JSON and then skips it. The skip keeps the nesting on a stack, so a deepmdatavalue uses no call stack.ndjson.rsis the record parser. A name, level or expression record goes into the store, and its handle goes into the index table of its kind. A declaration record becomes aDecl.decl.rsis the declaration stream of spec 04.7. It keeps every field of the input, also the fields that the checker computes again. The checker compares them and does not trust them (06.1).error.rshas the error kinds. Each kind is a reject or a decline. An unknown version, an index above the table limit and a full store are declines.Input rules of 07.1.2
\usurrogate without its pair is a reject.natValhas no leading zeros except for "0". The parser checks the bound of 05.8 from the string length before the conversion, and from the bit count after it.mdatais stripped. The record index gets the handle of the inner expression.Tests
tests/rules.rshas one test for each rule above.tests/rules.rsalso changes, deletes and adds bytes in a valid input 20,000 times. No run panics.tests/arena.rsparses all Arena tests whenRULEAN_ARENAor_tmp/arena/testsexists. Locally, all 225 tests parse, with 16,809 declarations. CI does not fetch the Arena in the test job yet. The next PR addsrulean check --parse-onlyon the Arena in CI.Notes
?, no closures and no early return in a loop. The first error of a line goes into the scanner state, and the rest of the line runs on dummy values. The parser writes into the store only when there is no error.