tree-sitter-julia

Fast, incremental Julia grammar for the Tree-sitter parsing framework.

Library
Cargo
v0.23.1
128stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
44/100Fair
Development Activity0
Maintenance20
Community76
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
75/100Good
Architecture82
Code Quality78
Innovation76
Learning Curve64

tree-sitter-julia is the Julia grammar for Tree-sitter, the incremental parsing library that underpins syntax highlighting and code intelligence in modern editors. It compiles Julia source into a concrete syntax tree that can be re-parsed efficiently as the document changes, providing the structural foundation for highlighting, folding, navigation, and analysis. It is maintained under the core Tree-sitter organization and covers Julia’s expressions, string macros, and unicode-aware syntax.

The grammar ships with prebuilt bindings for Rust, C, Node.js, Python, Go, and Swift, so the same parser can be embedded in editors, language servers, and static-analysis pipelines regardless of host language.

What You Get

  • A complete Julia grammar (grammar.js) plus the generated C parser (src/parser.c) ready to compile
  • Rust bindings exposing the parser through the tree-sitter-language interface
  • Additional bindings for C, Node.js, Python, Go, and Swift from a single grammar source
  • Highlight and query files (queries/) for syntax highlighting and code navigation
  • A corpus test suite exercising the grammar’s constructs and error recovery

Common Use Cases

  • Powering syntax highlighting for Julia in code editors and terminal viewers
  • Building language servers and linters that need a structured view of Julia code
  • Enabling code folding, structural selection, and outline views for Julia files
  • Extracting or transforming Julia content programmatically via the syntax tree

Under The Hood

Architecture - The grammar is declared in grammar.js using Tree-sitter’s JavaScript DSL, defining Julia’s syntactic constructs with extras for whitespace and comments and, where needed, externals for context-sensitive tokens resolved by a custom scanner. The Tree-sitter CLI compiles this into a deterministic C parser (src/parser.c) that host bindings load at runtime. Tech Stack - The source of truth is the JavaScript grammar DSL; the generated parser is C. The Rust binding depends on tree-sitter-language and compiles the generated parser via a cc-based build script, exposing a LANGUAGE constant. Parallel bindings for C, Node.js, Python, Go, and Swift are generated from the same grammar. Code Quality - Correctness is anchored by Tree-sitter’s corpus test format (input snippets paired with expected S-expression trees) plus highlight fixtures, and CI runs on GitHub Actions. The generated parser is machine-produced and never hand-edited, so quality tracks the grammar definition and its tests. API Design - Integration is minimal: consumers pass the language’s exported LANGUAGE entry point to a Tree-sitter parser instance in their host language, so adding Julia parsing to an editor or tool takes only a few lines once the Tree-sitter runtime is present.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search