July 21st, 2024

Baby's Second WASM Compiler

A new wasm compiler named zest is under development for 2024, focusing on quality and speed enhancements. It supports various features and employs a tree structure for expressions, emphasizing efficiency and simplicity.

Read original articleLink Icon
Baby's Second WASM Compiler

In 2024, a new wasm compiler called zest is being developed, consisting of around 4500 lines of code with no external dependencies except the zig standard library. The compiler aims to improve wasm generation quality and speed, with optimizations planned to reach llvm's -O1 level. The language supports various features like integers, structs, control flow, functions, closures, and more. The compiler pipeline involves multiple stages such as parsing, desugaring, evaluation, type inference, and wasm generation. The design focuses on a tree structure for expressions, optimizing memory usage and access patterns. The compiler's approach to handling values, function arguments, and memory allocation is described, emphasizing simplicity and potential future optimizations. The compiler's stack management, type inference, and recursive processes are discussed, highlighting trade-offs between efficiency and complexity. The compiler's code generation strategy is detailed, utilizing abstract values (Walues) to handle expressions and optimize memory usage. The design choices aim to balance efficiency, simplicity, and flexibility in the compiler's development and future improvements.

Related

CPS in Hoot

CPS in Hoot

The Hoot Scheme-to-Wasm compiler uses CPS transformation to handle push calls in WebAssembly. Strategies like generic slicing and CPS transformation are explored, enabling features like Fibers and promise integration. Performance impact is under evaluation.

Zig-style generics are not well-suited for most languages

Zig-style generics are not well-suited for most languages

Zig-style generics, inspired by C++, are critiqued for limited universality. Zig's simplicity contrasts with Rust and Go's constraints. Metaprogramming praised for accessibility, but error messages and compiler support pose challenges. Limited type inference compared to Swift and Rust.

Improving Your Zig Language Server Experience

Improving Your Zig Language Server Experience

Enhance Zig Language Server (ZLS) by configuring it to run build scripts on save for immediate error display. Zig project progresses include faster builds, incremental compilation, and code intelligence. Support via Zig Software Foundation donations.

Dynamic Translation of Smalltalk to WebAssembly

Dynamic Translation of Smalltalk to WebAssembly

The article explores Smalltalk code translation to WebAssembly (WASM) within the Catalyst project. It details levels of Smalltalk, JavaScript, and WASM, focusing on direct Smalltalk to WASM optimization. A new translator, WATCompiledMethodTranslator, aids in this process, exemplified by a Smalltalk expression conversion. Creation of a WASM module for Smalltalk methods is explained, highlighting performance advantages and potential future comparisons with dynamic JS translations. Collaboration in the Smalltalk community is encouraged for further advancement.

What can TypeScript learn from Zig? What can Zig learn from TypeScript?

What can TypeScript learn from Zig? What can Zig learn from TypeScript?

A TypeScript developer discusses using Zig in Advent of Code 2023. Zig, a modern low-level language, emphasizes safety with features like option types and compile-time execution. TypeScript could benefit from Zig's error detection approach.

Link Icon 0 comments