tree-sitter-clean
Clean grammar for tree-sitter.
Description
Clean is a general-purpose, purely functional programming language with uniqueness typing. This grammar supports:
- Module system (
module,import,from...import) - Type system (
::, algebraic data types, records, type classes) - Functions (named, guards,
where/withclauses) - Patterns (variables, constructors, wildcards, lists, tuples)
- Expressions (application, infix operators, let, case, lambda)
- Comprehensions (list comprehensions with generators, guards, let qualifiers)
- Records (construction, update, field access)
Coverage
The grammar is validated against the real-world Clean corpus
(clean-stdlib, Clyde, cloogle.org — 120 .icl + 119 .dcl files):
- 1833 ERROR nodes across the
.iclcorpus vs 5129 before the grammar overhaul (2.8× better), with the core stdlib (StdEnv, StdList, StdString, StdMaybe) at 0 errors - 13 ERROR nodes across the
.dclcorpus (down from 282) - 55/55 corpus tests, parse throughput ~1.3× the pre-overhaul parser
Known Gaps
Clean constructs the grammar does not (fully) parse yet are documented in GRAMMAR-GAPS.md, along with the approaches that were tried and rejected on the full corpus. Remaining gaps are confined to regions the reference parser also fails heavily; closing them is blocked by a tree-sitter generator action-table ceiling (see the doc).
Node Types
The grammar produces 189 named node types for precise AST analysis, including:
application— function/constructor call detectionfield_access— record field accesslist_comprehension— withgenerator,guard,let_qualifierrecord_expression/record_update— record manipulationwildcard—_patterntype_definition/type_signature/class_context— the type system
Usage
Rust
let mut parser = tree_sitter::Parser::new();
parser.set_language(&tree_sitter_clean::LANGUAGE.into())?;
Add tree-sitter-clean to your Cargo.toml to use it as a dependency:
[dependencies]
tree-sitter-clean = "1.2"
JavaScript
const Parser = require("tree-sitter");
const Clean = require("tree-sitter-clean");
const parser = new Parser();
parser.setLanguage(Clean);
Python
import tree_sitter_clean
References
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tree_sitter_clean-1.2.0.tar.gz.
File metadata
- Download URL: tree_sitter_clean-1.2.0.tar.gz
- Upload date:
- Size: 2.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
444fdefda08e64cab5f7cbc51e9beb195e1fe76932479599349bd5cdf2cad31e
|
|
| MD5 |
5fea65e5b964d49436d7363e4a01f434
|
|
| BLAKE2b-256 |
dd2e4db8e0b10fd52f0a247ffbab013c40c673f7089c2effa0a8d7a813b8bc5a
|
File details
Details for the file tree_sitter_clean-1.2.0-cp310-abi3-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: tree_sitter_clean-1.2.0-cp310-abi3-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 790.0 kB
- Tags: CPython 3.10+, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d99abd30de8212f30f347dcc8eec423bf9e6f1e262192bd0dd6ff3f150b7962f
|
|
| MD5 |
623c1dc34448573adad0474d161389be
|
|
| BLAKE2b-256 |
22040eb670244080104057c92de68810bff408b1aca6ad52be6732505ad6b959
|