Skip to content

feat: add WAT tab with live disassembly and syntax highlighting#20

Merged
kollhof merged 1 commit into
mainfrom
feat/wat-tab
Mar 25, 2026
Merged

feat: add WAT tab with live disassembly and syntax highlighting#20
kollhof merged 1 commit into
mainfrom
feat/wat-tab

Conversation

@kollhof

@kollhof kollhof commented Mar 25, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds compile_wat() WASM export: same codegen pipeline as compile() but disassembles via wasmprinter::print_bytes
  • New WatPanel — read-only Monaco editor, updated live on every reparse
  • Hand-written Monarch tokenizer for WAT (zero extra deps — no onigasm, no TextMate pipeline)
  • WAT tab added to the right pane tab bar; layout triggered on activate

Test plan

  • Type main = fn: 1 + 2, switch to WAT tab → see disassembly update live
  • Verify syntax highlighting: keywords (func, struct.new, etc.), $identifiers, numbers, comments
  • Syntax error in source → WAT tab shows previous valid output (compile_wat is try/caught)

- Add compile_wat() wasm-bindgen export in lib.rs: same pipeline as
  compile() but calls wasmprinter::print_bytes to produce WAT text
- Add wasmprinter = "0.245" as an explicit Cargo dep (was transitive)
- Add compileWat() to compiler.ts, called on every reparse in main.ts
- Add WatPanel (src/wat-panel.ts): read-only Monaco editor with a
  hand-written Monarch tokenizer for WAT — no onigasm/TextMate deps
  Covers: keywords, $identifiers, numbers (hex/float/inf/nan),
  strings, ;; line comments, (; ;) block comments, inline annotations
- Wire WAT tab in fragment.html and main.ts (layout() on tab activate)
@github-actions

Copy link
Copy Markdown

This PR will release v1.13.0

@kollhof kollhof merged commit 08d234d into main Mar 25, 2026
2 checks passed
@kollhof kollhof deleted the feat/wat-tab branch March 25, 2026 15:43
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.13.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