All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

gotreesitter: Pure Go Implementation of Tree-Sitter Parser Library

By

odvcencio

3mo ago· 11 min readenCode

Summary

gotreesitter is a pure Go implementation of the tree-sitter parsing library that eliminates CGo dependencies, allowing cross-compilation to any platform Go supports including WebAssembly. The project loads the same parse-table format as the C runtime, extracts grammar tables from upstream parser.c files via ts2go, compresses them into binary blobs, and ships 206 grammars in its registry. The implementation includes the parser, lexer, query engine, incremental reparsing, arena allocator, external scanners, and tree cursor functionality without any C dependencies.

Key quotes

· 4 pulled
Pure-Go tree-sitter runtime. No CGo, no C toolchain. Cross-compiles to any GOOS/GOARCH target Go supports, including wasip1.
gotreesitter loads the same parse-table format that tree-sitter's C runtime uses. Grammar tables are extracted from upstream parser.c files by ts2go, compressed into binary blobs, and deserialized on first use.
Every Go tree-sitter binding in the ecosystem depends on CGo: gotreesitter eliminates the C dependency entirely.
The parser, lexer, query engine, incremental reparsing, arena allocator, external scanners, and tree cursor functionality are implemented in pure Go.
Snippet from the RSS feed
Pure Go tree-sitter runtime. Contribute to odvcencio/gotreesitter development by creating an account on GitHub.

You might also wanna read