Commit 0c15133
feat(codegen): complete .twasm front-end for the example corpus (2/6 -> 6/6)
Extends the v0 front-end + codegen so all six canonical examples parse, emit
valid wasm, and round-trip through the verifier (Phase 1 / #130):
- parser: ptr<T>/unique<T>/ref<T> field pointers (03); optional/unnamed fn
params + &mut/&/own region<T> borrow params (05, 06); general annotation-clause
skip (cost_bound { ... } etc., 05); import region X from "..." {...}|;
with quoted module source (06, 02); invariant { ... } region constraint
blocks (02).
- codegen: typed result stubs — Op::{I64Const,F32Const,F64Const} + mappings, so
representative bodies type-check against f32/i64/f64 result types (03).
- tests: parsed_example_corpus_round_trips round-trips all six examples
(the #130 soundness gate over real .twasm, not just paint-type/example-01).
Still v0 (type-correct representative bodies, not full region.get/set lowering;
the six canonical examples, not arbitrary .twasm). 31/31 codegen tests pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 42321e7 commit 0c15133
3 files changed
Lines changed: 132 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
185 | 188 | | |
186 | 189 | | |
187 | 190 | | |
| |||
330 | 333 | | |
331 | 334 | | |
332 | 335 | | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
333 | 339 | | |
334 | 340 | | |
335 | 341 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
211 | 226 | | |
212 | 227 | | |
213 | 228 | | |
| |||
275 | 290 | | |
276 | 291 | | |
277 | 292 | | |
278 | | - | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
279 | 318 | | |
280 | 319 | | |
281 | 320 | | |
| |||
529 | 568 | | |
530 | 569 | | |
531 | 570 | | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
536 | 577 | | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
537 | 584 | | |
538 | 585 | | |
539 | 586 | | |
| |||
570 | 617 | | |
571 | 618 | | |
572 | 619 | | |
573 | | - | |
574 | | - | |
575 | | - | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
576 | 624 | | |
577 | | - | |
578 | | - | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
579 | 639 | | |
580 | | - | |
| 640 | + | |
581 | 641 | | |
582 | 642 | | |
583 | 643 | | |
| |||
590 | 650 | | |
591 | 651 | | |
592 | 652 | | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
597 | 662 | | |
598 | 663 | | |
599 | 664 | | |
| |||
773 | 838 | | |
774 | 839 | | |
775 | 840 | | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
776 | 847 | | |
777 | 848 | | |
778 | 849 | | |
779 | 850 | | |
780 | | - | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
781 | 861 | | |
782 | | - | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
783 | 869 | | |
784 | 870 | | |
785 | 871 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
156 | 179 | | |
157 | 180 | | |
158 | 181 | | |
| |||
0 commit comments