---
title: "Extensible Language Support in Zed - Part 1"
description: "Zed loads third-party Tree-sitter grammars as WebAssembly modules using a hybrid design."
url: "https://swe.quest/articles/extensible-language-support-in-zed-part-1-13bc037c6f5096a9"
canonical: "https://zed.dev/blog/language-extensions-part-1"
source: "Zed"
published: "2024-04-18"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 7
tags: ["webassembly","developer-tools","sandboxing","compilers","rust"]
---

# Extensible Language Support in Zed - Part 1

A post on [Zed](https://swe.quest/sources/zed.md), published 2024-04-18, 7 min read, Deep dive. Original: [https://zed.dev/blog/language-extensions-part-1](https://zed.dev/blog/language-extensions-part-1)

## Summary

Zed loads third-party Tree-sitter grammars as WebAssembly modules using a hybrid design. Native code consumes the parser's static parse tables after they are copied out of wasm linear memory, while only the lexing functions, including hand-written external scanners, run inside Wasmtime. This avoids depending on the user's C compiler and keeps buggy scanners from crashing the editor. It also avoids copying large syntax trees out of wasm memory on every keystroke. A new \`WasmStore\` API lets wasm-loaded languages behave identically to native ones, and a bundled mini-libc with a bump allocator that is reset each parse makes scanner memory leaks impossible.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [WebAssembly](https://swe.quest/tags/webassembly.md) (Languages)
- [Developer tools](https://swe.quest/tags/developer-tools.md) (Engineering practices)
- [Sandboxing & isolation](https://swe.quest/tags/sandboxing.md) (Security)
- [Compilers](https://swe.quest/tags/compilers.md) (Compilers & runtimes)
- [Rust](https://swe.quest/tags/rust.md) (Languages)

## Prerequisites

- Tree-sitter basics
- WebAssembly linear memory ([easy posts on WebAssembly](https://swe.quest/tags/webassembly.md?difficulty=easy))
- lexing and parsing concepts

## Keywords

Zed, Tree-sitter, Wasmtime, WebAssembly, WasmStore, Language Server Protocol

## Related posts

- [Life of a Zed Extension: Rust, WIT, Wasm](https://swe.quest/articles/life-of-a-zed-extension-rust-wit-wasm-ec148b04db708b5a.md): Zed · 2024-10-21 · Medium · 21 min read · WebAssembly, Rust, Developer tools
  Zed extensions are written in Rust but never compiled on the user's machine.
- [A new way to bring garbage collected programming languages efficiently to WebAssembly · V8](https://swe.quest/articles/a-new-way-to-bring-garbage-collected-programming-languages-efficiently-to-667c409700cf29b4.md): V8 · 2023-11-01 · Hard · 20 min read · WebAssembly, Memory management, Runtimes & VMs, Compilers
  Garbage-collected languages like Java, Kotlin, Dart, Python and C# can reach WebAssembly in two ways: compile an existing language VM to linear-memory WasmMVP, or lower the language's objects onto WasmGC structs and arrays managed by the host VM's garbage collector.
- [Contributing support for a Wasm instruction to Winch](https://swe.quest/articles/contributing-support-for-a-wasm-instruction-to-winch-3a4d14391ef1d680.md): Shopify Engineering · 2023-07-18 · Hard · 9 min read · WebAssembly, Compilers, Rust, Testing, Open source
  Adding a WebAssembly instruction to Winch, Wasmtime's baseline non-optimizing compiler, touches several layers: the wasmparser VisitOperator visitor, the CodeGenContext that manages the value stack, register allocation and spilling, an ISA-independent MacroAssembler, and an x86\_64 assembler built on Cranelift's ISLE-generated instruction definitions.
- [Enabling low-latency, syntax-aware editing using Tree-sitter](https://swe.quest/articles/enabling-low-latency-syntax-aware-editing-using-tree-sitter-9ffe8225d976568b.md): Zed · 2023-03-27 · Medium · 10 min read · Developer tools, Compilers, Data structures, Rust
  Zed builds its syntax-aware features on Tree-sitter, a GLR-based incremental parsing framework with error recovery that produces concrete syntax trees.
- [Why is WebAssembly a second-class language on the web?](https://swe.quest/articles/why-is-webassembly-a-second-class-language-on-the-web-36ba94a05082ce89.md): Mozilla Hacks · 2026-02-26 · Medium · 13 min read · WebAssembly, Browsers, Language design, Performance engineering
  WebAssembly remains second-class on the web because it can only load code and reach Web APIs through JavaScript.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
