Skip to content

feat(WO16): ISC-WF-1 workflow extension in interscript-py - #833

Merged
ronaldtse merged 1 commit into
mainfrom
feat/isc-wf1-py
Nov 8, 2026
Merged

ronaldtse merged 1 commit into
mainfrom
feat/isc-wf1-py

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Summary

Implements the ISC-WF-1 workflow extension (maps docs/isc-wf-1.md, W1 named rulesets, W2 use-with-override, W3 language conditioning) in interscript-py:

  • New src/interscript/isc.py: recursive-descent .isc parser (port of interscript-ts src/isc/parser.ts). W1/W2 resolve at parse time — macro splice of expanded ruleset items at the use position, recursive with cycle detection; child-wins row overrides on exact from-equality; cross-map use alias.<ident> via a dependency resolver callback.
  • W3 is a runtime concern: the IR gains only optional languages (document) and optional when arrays (sub rules); the executor filters per the caller-selected language — guards inert without a selection, guard-applicable beats unguarded same-from, at literal level in tree mode and compiled-pattern level in megaregexp mode. Public API gains an optional language parameter (transliterate(..., language=)).
  • Additive only: IR shapes unchanged for maps that do not use the constructs.

Verification

  • 74 new tests (tests/test_isc_wf1.py, tests/test_isc_parser.py) — parser constructs, expansion/cycles, override merge, guard precedence/inertness, additive IR decode, synthetic fixtures through the full parse-execute path.
  • Parse fidelity: parse_isc + convert output is structurally identical to the TypeScript-built compiled artifact for all 404 corpus maps; all 408 corpus .isc sources (maps + libs) parse.
  • Additivity gate: independently re-verified against the rs golden capture (interscript-rs tests/golden/isc-wf0.jsonl, 11,048 rows, fresh IR artifact built from current corpus) — 11,043/11,048 byte-identical; the 5 deltas are the known pre-existing alalc-ell-Grek-Latn-2010 executor constraint issue (tracked separately, pre-dates this change and is unrelated to ISC-WF-1).

Implement the ISC-WF-1 workflow extension in the Python runtime per
maps docs/isc-wf-1.md (normative draft 1.0):

- new src/interscript/isc.py: recursive-descent .isc parser (port of
  interscript-ts src/isc/parser.ts). W1 named rulesets and W2
  use-with-override resolve at parse time: macro splice of expanded
  ruleset items at the use position, recursive with cycle detection
  (parse error), child-wins row overrides on exact from-equality
  (kept-in-order then overrides; unmatched overrides appended), with
  cross-map `use alias.<ident>` via a dependency resolver callback.
- W3 language conditioning is runtime: the IR gains only optional
  `languages` on the document and optional `when` arrays on sub rules;
  the executor filters per the caller-selected language (guards inert
  without a declared selection; a guard-applicable rule beats an
  unguarded same-from rule, at the literal level in tree mode and at
  compiled-pattern level in megaregexp mode). The public API gains an
  optional language parameter.
- parse fidelity: parse+convert output is structurally identical to
  the TypeScript-built compiled artifact for all 404 corpus maps, and
  all 408 corpus .isc sources (maps + libs) parse.

Tests: 74 new (parser constructs, expansion/cycles, override merge,
guard precedence/inertness, additive IR decode, synthetic fixtures
through the full parse-execute path). Additivity gate: all 11,048
golden rows byte-identical before/after; the existing suite is
unchanged.
@ronaldtse
ronaldtse merged commit 64f30b4 into main Nov 8, 2026
12 of 13 checks passed
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.

1 participant