Skip to content

Upgrade fink to v0.64.0 and run programs in-browser#22

Merged
kollhof merged 1 commit into
mainfrom
feat/deps-upgrade-2
May 1, 2026
Merged

Upgrade fink to v0.64.0 and run programs in-browser#22
kollhof merged 1 commit into
mainfrom
feat/deps-upgrade-2

Conversation

@kollhof

@kollhof kollhof commented May 1, 2026

Copy link
Copy Markdown
Member

Summary

  • Upgrade fink from v0.4.0 to v0.64.0; rewrite the playground crate to match the new compiler API (flat-AST arena, name_res folded into scopes, struct-style `NodeKind::Module`, typed stage chain).
  • Switch CPS / lifted / WAT panels from SMv3 to fink's native byte-offset sourcemap. New shared decoder (`src/native-sourcemap.ts`) handles byte → line/col conversion. Lifted CPS now uses the flat formatter — reads as plain assignments.
  • WAT pipeline goes through `compile_package` + `fmt_fragment_with_sm` (same path as `fink wat`).
  • Tier-1 in-browser runner: real `compile()` returns the WASM binary; `src/runner.ts` instantiates with no-op host imports (host_panic throws, rest swallow). Programs execute end-to-end — stdout/stderr capture deferred until `interop/js.wat` lands upstream.

Test plan

  • `make build` produces `build/` cleanly
  • All four panels (Tokens, AST, CPS, Lifted, WAT) render without errors for the default sample
  • Cursor sync source ↔ CPS / Lifted works
  • Source ↔ WAT cursor sync renders (positions known to be approximate; upstream will tighten)
  • Click ▶ Run on a pure-compute program — gets `OK — ran ./playground.fnk` with timing
  • Click ▶ Run on a program with an irrefutable pattern failure — gets `panic: fink panic`

Three logical changes bundled together since they overlap heavily in
the same files:

- Upgrade fink from v0.4.0 to v0.64.0 (and esbuild 0.27 → 0.28).
  The fink compiler API was rewritten over many minor versions:
  flat-AST arena (no more recursive Node traversal), name_res folded
  into scopes, struct-style NodeKind::Module, parser::parse takes a
  url, partial::apply / scopes::analyse take Ast directly, new typed
  stage chain (parse → desugar → lower → lift → compile_package).
  Playground crate rewritten to match.

- Switch CPS / lifted / WAT panels from inline SMv3 sourcemaps to
  fink's native byte-offset sourcemap. New shared decoder in
  src/native-sourcemap.ts converts byte offsets to line/col using a
  one-shot LineMap. Lifted CPS now uses the flat formatter
  (lifting::fmt::fmt_flat_mapped_native) — reads as a sequence of
  assignments instead of nested ·fn / ·let.
  WAT pipeline now goes through compile_package + fmt_fragment_with_sm
  (matches `fink wat`).

- Tier-1 in-browser runner: real compile() returns the WASM binary,
  src/runner.ts instantiates with no-op host imports (host_panic
  throws, the rest swallow). Exercises end-to-end module-body
  execution; stdout/stderr capture deferred until interop/js.wat
  exists upstream. Replaces the obsolete wasi-shim.ts.
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

This PR will release v1.15.0

@kollhof kollhof merged commit ce68f4d into main May 1, 2026
2 checks passed
@kollhof kollhof deleted the feat/deps-upgrade-2 branch May 1, 2026 14:52
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.15.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant