Skip to main content

tree-sitter-clean

CI discord matrix npm pypi crates.io

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/with clauses)
  • 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 .icl corpus 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 .dcl corpus (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 detection
  • field_access — record field access
  • list_comprehension — with generator, guard, let_qualifier
  • record_expression / record_update — record manipulation
  • wildcard_ pattern
  • type_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

Releasing

See RELEASE.md for the verified procedure to publish to npm, PyPI, and crates.io.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tree_sitter_clean-1.2.4.tar.gz (2.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tree_sitter_clean-1.2.4-cp310-abi3-manylinux_2_39_x86_64.whl (777.6 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.39+ x86-64

File details

Details for the file tree_sitter_clean-1.2.4.tar.gz.

File metadata

  • Download URL: tree_sitter_clean-1.2.4.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

Hashes for tree_sitter_clean-1.2.4.tar.gz
Algorithm Hash digest
SHA256 399d1aaa073436a44bda2b0c831d4b57db646dd277e4c1614a1c1a5e20b81d86
MD5 980ea7413d4de17b96dbb97497bcfe67
BLAKE2b-256 c8e0ffb2b10c7e3f78a2508e83f385be98b8f97710f8350031ae263e5e848f02

See more details on using hashes here.

File details

Details for the file tree_sitter_clean-1.2.4-cp310-abi3-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_clean-1.2.4-cp310-abi3-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 285d637b2f4dd0137371eb800df72f9a14312b91671a4ee5d28bee52606814a0
MD5 ddf3cd2a9518ad84b1fbf266ea7e1978
BLAKE2b-256 9176e89565a0117a79d3a85d8a28dffbd6d64347f21ffc64b8539c0266ee0de7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page