PeaBox Lab › PeaLang › Learn › Chapter 23 › Lesson 2

Part IV — Expert Production Engineering · Chapter 23 · Lesson 2 of 6 · 2 min read

Lesson 2: WASM v1 Containers and PeaLang Custom Sections

Lesson level: Expert

Purpose: RC2 demonstrates WASM-compatible packaging of PEAC and metadata. Do not infer a complete native browser VM from that packaging.

Learning Objectives

2.1 Concepts

The RC2 builder emits the WebAssembly v1 magic and version bytes, then custom sections named pealang.manifest and pealang.peac. The manifest identifies PEAWASM, the pea-browser-abi-1 ABI, listed imports and exports, and policy. The PEAC section carries a JSON bytecode module. This is an artifact container contract. The builder shown in the source does not emit executable WASM function bodies or a callable pea_run export merely because the manifest lists that name.

2.2 Annotated Example

compile_peac_to_wasm(module).to_bytes() serializes the header plus the two custom sections. inspect_wasm reads the header and decodes those sections. A browser can instantiate a custom-section-only module successfully while its actual exported-function collection is empty. Check executable exports separately from the JSON export list.

2.3 Guided Practice

Compare container format, manifest ABI, embedded PEAC version, and actual WebAssembly exports. Explain why all four are needed to assess an execution claim.

2.4 Common Mistakes

Do not call a valid WASM header proof of PeaLang execution, treat a manifest entry as a real native export, or assume the parser is a hardened adversarial binary validator.

2.5 Hands-On Lab

Deliverable: Artifact report, permission matrix, and observed support/failure evidence.

2.6 Review Questions

What do the custom sections contain? Where would executable function bodies have to appear? Why can instantiation succeed without running the program?

2.7 Applied Challenge

Write an artifact capability report that distinguishes container inspection from execution and marks every unsupported operation explicitly.

Lesson Summary

RC2 demonstrates WASM-compatible packaging of PEAC and metadata. Do not infer a complete native browser VM from that packaging.

Lesson status: Draft complete; ready for review. Source-checked, not browser-execution validated.

← Previous Next →