Scheme parser for tree-sitter.
-
2026-10-12: Released 0.25.0. Maintained parsers for R5RS, R6RS, R7RS-small, Chez Scheme, Guile, and CHICKEN Scheme live under
dialects/. The defaultschemeparser accepts all three standards plus some extensions. Reusable reader fragments live undergrammar/. See docs/design.md to add, change, or make yourself a dialect. -
2026-10-12: 0.25.0 is a breaking change. The default parser is not compatible with 0.24.7-1. See nodes.md.
syntaxis nowsyntax_quote#;issexp_comment, notcomment- New nodes:
dot,datum_label,datum_label_id,datum_reference listis()or[]only;.is a childdotbyte_vectoralso matches#u8(...)- Dropped extensions:
{}lists, symbols that start with a digit,\+ any character in strings, extra character names (#\bel,#\ls,#\nel,#\rubout,#\vt)
The default scheme parser accepts the union of R5RS, R6RS, and R7RS-small
reader syntax. When the standards disagree on a token boundary, it uses the
R6RS reading.
Extensions:
- Steel Scheme
#\uhexadecimal characters #:keywords
More syntax is welcome if it is widely used. Please open an issue. If you want dialect specific syntax very much, prefer a dialect parser.
Separate parsers live under dialects/. Each is its own Tree-sitter
language named scheme, not a drop-in for the default parser:
dialects/r5rs/— R5RSdialects/r6rs/— R6RSdialects/r7rs/— R7RS-smalldialects/chez/— Chez Scheme 10.4dialects/guile/— GNU Guile 3.0.11dialects/chicken/— CHICKEN Scheme 6.0.0
See each dialect grammar.js for coverage. Chez, Guile, and CHICKEN also
have notes in docs/. Generate a dialect from its own directory; see
CONTRIBUTING.md.
- Support for implementation
See nodes.md for the default parser's visible nodes.
This parser doesn't parse language constructs. Instead, it parses code as lists.
If you want language constructs support, use custom queries (see #5), also see thchha/tree-sitter-scheme.
To use a dialect parser, clone this repository, generate and build that dialect with the tree-sitter CLI, then copy the compiled library to the location your editor requires:
npm install
cd dialects/r5rs
npx tree-sitter generate
npx tree-sitter buildReplace r5rs with r6rs, r7rs, chez, guile, or chicken.
Generate from the dialect directory; generating from the repository
root overwrites default src/. See CONTRIBUTING.md.
If you want to make your own parser, look at the reusable fragments in
grammar/ and the notes in
docs/design.md and
docs/dialect-workflow.md.
The queries here are too simple and not intended to be useful in an editor. You need to write by yourself, according to the grammar files.
Scheme
- R5RS
- R6RS
- R7RS-small
- The Scheme Programming Language
- Chez Scheme User's Guide
- GNU Guile Reference Manual
- CHICKEN Scheme User's Manual
Tree-sitter