Skip to content

[Repo] Migration assistant tool: parser + metaparser for .res→.affine skeletons #57

Description

@hyperpolymath

Proposal

Build a migration assistant: a tool that reads .res files, recognises common patterns, and emits .affine skeletons. Not a transliterator — the human picks the decomposition; the tool emits the AffineScript syntax.

Capabilities

  • Read .res AST (via ReScript's bs-tools or similar)
  • Map known patterns:
    • let _ = X.constructor → call out "explicit registration needed"
    • Promise.catch(e => ...) → "Promise umbrella, propose Result + sum"
    • Named-arg lambda blob → "row-poly handler record candidate"
    • 4+ tuple match → "Validation chain candidate"
  • Surface patterns without a clean translation (effect handlers, exceptions, mutable globals) for human decision
  • Output .affine skeletons + a comment-block listing the migration considerations

Why this is also the metaparser story

This tool is a parser for .res that produces an AST and emits .affine syntax — a metaparser, in the architectural-recommendation sense. Once it exists, the same machinery can drive other migrations (.ts.affine, .js.affine, etc.). It's the first concrete user of the "tree-sitter as canonical grammar source" architecture.

Why this matters for idaptik

idaptik has 542 .res + ~80 .ts files to migrate. By-hand is impractical; a per-pattern transliterator misses the point of re-decomposition. The migration assistant is the middle ground.


Filed from idaptik Wave 3 pilot. See LESSONS.md and PILOT.md. Idaptik commit hyperpolymath/idaptik@aef38db.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions