Releases: muhammad-fiaz/tree-sitter.zig
Release list
v0.0.1
This releases tree-sitter.zig v0.0.1, the first release of a native Zig Tree-sitter runtime.
What This Release Is About
v0.0.1 establishes the core parsing foundation for building editors, analyzers, language tooling, and other syntax-aware applications in Zig.
This release brings together a complete parsing runtime with incremental parsing, syntax tree traversal, structural queries, language definitions, flexible input sources, error recovery, Unicode support, external scanners, and allocator-controlled memory management.
Highlights
Core Parsing
- Table-driven LR parsing
- Shift, reduce, and accept operations
- Lookahead handling
- Generic language definitions
- Syntax tree construction
- Exact byte and source positions
Incremental Parsing
- Reparse existing trees after edits
- Reuse unchanged subtrees
- Track reused nodes
- Calculate changed ranges
- Apply edits directly to existing trees
Syntax Trees
- Root and child node access
- Tree walking
- Tree cursors
- Parent and sibling navigation
- Descendant lookup
- Field tracking
- Node text and source ranges
Queries
- Structural pattern matching
- Captures
- Fields
- Wildcards
- Quantifiers
- Anchors
- Predicates
- Query directives
Supported predicates include #eq?, #match?, #contains?, #any-of?, and #is?, along with their supported variants and negations.
Language System
- Symbols
- Parse tables
- Fields
- Aliases
- Supertypes
- Language metadata
- ABI validation
- Symbol and field lookup
v0.0.1 also includes expression, s-expression, JSON, and outline grammars.
Input
Parse source from:
- Memory slices
- Custom callbacks
std.Io.Reader- Reader sources
- Streaming input
- UTF-16 LE and BE sources
Error Recovery
The parser can continue through malformed input while representing problems directly in the resulting syntax tree through ERROR and MISSING nodes.
External Scanners
A Zig-native external scanner interface is included, with state-aware scanner dispatch for grammars that require custom lexical behavior.
Memory Management
All parser resources use an explicit caller-provided allocator, with parser, tree, cursor, query, and query-cursor lifetimes managed through their respective APIs.
Unicode
- UTF-8 source positions
- Exact byte offsets
- UTF-16 LE and BE input
- BOM handling
- Surrogate validation
Debugging
- Configurable logging levels
- Parse-event tracing
- Logger prefixes
- Parser scratch-memory reset
Validation
The initial release includes:
- 129 inline tests
- 19 differential conformance cases
- Seeded fuzz testing
- Benchmarks
- Usage examples
- Formatting checks
The documented release validation targets are all green.
Performance
The release includes benchmarks covering parsing, repeated parsing, incremental parsing, tree traversal, and query execution.
The documented ReleaseFast benchmark reaches approximately 8 MB/s parsing throughput, with around 40,000 subtrees reused in the tested leading-edge incremental edit.
Platform Support
v0.0.1 supports Windows, Linux, and macOS across x86, x86_64, and ARM64 targets, with wasm32-wasi also validated.
Documentation
The release includes documentation covering guides, concepts, examples, use cases, API reference, internals, development, compatibility, and FAQ, providing a complete starting point for using and understanding the runtime.
Requirements
Zig 0.16.0 is required for v0.0.1.