Skip to content

Replace optimal-channels with gslt-to-rholang#49

Open
metaweta wants to merge 1 commit into
mainfrom
gslt-to-rholang
Open

Replace optimal-channels with gslt-to-rholang#49
metaweta wants to merge 1 commit into
mainfrom
gslt-to-rholang

Conversation

@metaweta

Copy link
Copy Markdown
Collaborator

Description

Turns out that the set automaton was designed with parallelism in mind and translates very naturally to rholang in a way that preserves all the opportunity for parallel processing. Here's a new paper describing how to compile a GSLT to rholang by using the set automaton.

@metaweta
metaweta requested a review from leithaus May 14, 2026 23:32
dylon added a commit that referenced this pull request May 18, 2026
…foundation

Lands the bulk of the WPDS-runtime parser migration substrate:

Fork fanout (F4-F8 + Option A):
- F4 BuilderDelta + pending_builder_ops for deferred SemanticBuilder mutations
- F5 apply_action_to_cursor with CursorOutcome { Drop, Alive, ForkInto, Resolved }
- F6 step_fanout four-case + commit_winner
- F7 binder Fork — multi-rule binder dispatch
- F8 cross-cat Fork — projection bucketing by source category
- Option A: per-cursor collection state (replaces overfit via_cross_cat filter)
- 41 walker tests pass

Batch 1 (surface cleanup):
- B5 (#57) Delete dead emit_engine_impl in engine_impl.rs (~85 LoC)
- B6 (#60) run_to_saturation surfaces Idle in non-terminal state as
  WpdsState::Error (was silent break); update 5 walker tests
- B9 (#63) facade.rs/mod.rs comment cleanup, point at #64/L12
- C6 (#59) Restore yeap/nope Bool fixtures in parity.rs

Batch 2 (codegen polish):
- C3 (#50) BigRat composite regex `<int>r(/<int>r)?` — `1r/2r` now lexes
  as one token. parity.rs adds 5 composite fixtures.
- B8 (#62) Refinement predicate body lowering in wpds_codegen/refinement.rs.
  Lowers Linear, And/Or/Not/Implies, TermEq/Neq, Relation, Quantified to
  closure bodies. compile_error! for multi-var Presburger and unbounded
  quantifiers. Wired register_refinements() emission + atomic-literal
  action wrapping with evaluate_refinement_predicate. Synthetic grammar
  refinementsmoke exercises the path; 4/4 smoke tests + 9 unit tests.
  Also fixes pre-existing Ascent emission bug: generate_refinement_type_rules
  now emits `if let BaseType::Variant(__inner) = x` to extract native
  value before linear comparison (was: `*x as i64` on enum, failed E0605).
- C4-C5 (#58) WpdsParseError::ParseFailed now carries
  attempts: Vec<RecoveryAttempt>. New facade entry parse_<Cat>_via_wpds_recovering
  returns (Result, Vec<RecoveryAttempt>); parse_recovering lifts each
  attempt to a ParseError::UnexpectedToken with recovery hint.
  3/3 recovery_accumulation tests.

Batch 3 (L-series foundation):
- L1 (#47) LexicographicWeight 4-tuple — adds lex_alt_idx: u16 priority
  axis above src_idx. New from_cost_with_lex(cost, src, rule, lex_alt).
  3-arg from_cost defaults lex_alt_idx: 0. 4 new tests; 27/27 lex_weight pass.
- L2 (#48) prattail/src/lexer_types.rs (new) — LexAlternative, LexEntry,
  LexStream, LexerConfig, ModeConfig, ModeId, UnicodeNormalForm. 4/4 tests.
- L3 (#49) TokenKind::LexError(LexErrorKind) with NoMatch/EvalFailed/
  UnexpectedEof variants. All codegen-time match sites use `unreachable!`
  for this runtime-only variant.
- L4 (#51) WpdsTokenSource extended with default-method peek_alternatives,
  is_ambiguous_at, end_byte. New MultiTokenSource backed by LexStream.

Batch 4 partial:
- L8 (#53) parse_<Cat>_via_wpds_with_weight facade entry returns
  (term, LexicographicWeight) on Accepted. parse_with_confidence rewires
  to use it: confidence = exp(-weight.primary) ∈ (0, 1].
- L11 codegen foundation (#67 partial) — language! options{} block now
  accepts case_insensitive: bool and unicode_normalization: NFC|NFD|NFKC|
  NFKD|none. Per-grammar lexer_config() emission via wpds_codegen::mod.rs
  reflects these flags. Runtime case-folding NFA + normalization pre-pass
  remain pending (separate follow-up).

Side effects:
- ast/src/language.rs: refinement_types declarations now also push a
  LangType entry so PosInt etc. are first-class categories with
  proc-relation/eq/rw declarations.
- prattail/src/runtime_types.rs: B11/B12 IntLit lossless coercion paths
  (to_bigint, as_i128, as_u64, as_u128 lossless; emit_native_conversion
  no longer routes wide-int targets through as_i64).
- prattail/src/int_lit.rs + tests/int_lit_tests.rs: B11/B12 conversions.
- prattail/src/wpds_walker.rs: F4-F8 walker integration.
- macros/src/gen/runtime/wpds_codegen/{prefix,binder,collection,infix,
  semantic_actions,synthetic}.rs: F4-F8 + B7 cross-cat collection element
  parsing wiring + B11 generalized literal-pattern emission.
- Deleted dead modules: cross_cat.rs, mixfix.rs, predicate.rs (B1, B2).

Tests at this commit:
- gen_calculator_op: 1327/1327 pass
- gen_calculator_unit: 172/172 pass
- gen_rhocalc_op: 532/532 pass
- gen_rhocalc_unit: 85/85 pass
- wpds_parity_calculator: 16/16 pass
- refinement_smoke: 4/4 pass (NEW, B8 verification)
- recovery_accumulation: 3/3 pass (NEW, C4-C5 verification)
- prattail lib: 4008/4008 pass (incl. 27 lex_weight, 4 lexer_types, 9 refinement)
- walker tests: 41/41 pass
- TOTAL: 2139+ verified tests, zero regressions

Remaining (7 tasks): L5, L6, L9, L10, L11 finalize, L12, Opt-Group.

Authoritative plan: /home/dylon/.claude/plans/wpds-completion-comprehensive.md
Memory: ~/.claude/projects/.../memory/wpds-completion-2026-04-28.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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