feat: the ISC grammar as a portable .parg artifact (278/285 tree-identical) - #781
Merged
Merged
Conversation
isc.parg — the whole grammar (8 concern files, ~55 rules) in the parsanol grammar language: one source compiled to a checksummed artifact that both parsanol-ruby and parsanol npm register natively. Differential gate (spec/support/parg_diff.rb): the artifact tree must equal the Ruby-DSL parser's tree (post-Normalizer) per map. Current corpus standing: 278/285 byte-identical; the rest are 2 files the Ruby parser itself rejects, one parallel-comment capture shape, one parse failure under investigation. Grammar-port invariants pinned by the gate: repetitions are ABNF prefixes (1*x); captures on whole alternations need outer parens; captures on rule references nest inner captures exactly like parslet .as; the item continuation needs the cont_stop/item_atom_start guards or 'to'/'before' get eaten as concat atoms.
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.
The ISC grammar as a portable .parg artifact — one grammar source for parsanol-ruby and parsanol npm.
lib/interscript/isc/grammar/isc.pargports all 8 grammar-concern files (~55 rules) to the parsanol grammar language, compiled to a checksummed artifact (isc.artifact.json, committed like pubid-grammar's). The Ruby side parses throughParsanol::PARG::Artifact#parse— the envelope's grammar is the exact portable JSON the native engines register, so the npm side consumes the same artifact.Differential gate (
spec/support/parg_diff.rb): the artifact tree must equal the Ruby-DSL parser's tree (post-Normalizer) per map. Current standing on the 285-file corpus: 278 byte-identical (97.5%). The remaining 7:un-mar-Deva-Latn-2016,odni-bel-Cyrl-Latn-2015) — pre-existing, unrelated to the artifactodni-kor-Hang-Latn-2015: comment-onlyparallel {}blocks — Ruby yields[], the artifact captures the comment; one routing shape to reconcilevar-kor-Hang-Latn-mr-1939: artifact-only parse failure under investigation (its constructs pass in isolation)Port invariants pinned by the gate (for the next grammar author):
1*x,*x; a rule body of a bare repetition needs parensx as nameafter a sequence binds the LAST primary — capture whole alternations/sequences with outer parens, or capture the rule reference at the use site.ascont_stop/item_atom_startguards, orto/beforeget eaten as concatenation atomsFull suite: 1149 examples, 0 failures with CI-equivalent flags. Upstream perf work on the artifact path is tracked in parsanol-ruby#115 (root-caused, fixed in parsanol#160).