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.5.tar.gz (2.2 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.5-cp310-abi3-manylinux_2_39_x86_64.whl (786.2 kB view details)

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

File details

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

File metadata

  • Download URL: tree_sitter_clean-1.2.5.tar.gz
  • Upload date:
  • Size: 2.2 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.5.tar.gz
Algorithm Hash digest
SHA256 82ff0455a733ec37e186bf880e0d939cf4ae275850c3a89c47f36423b142c15f
MD5 ca781080d2b777bf71b9822a9a2cb809
BLAKE2b-256 26a8fa795c7382c700ddf6b667a303390db77cc215eab24438093b4c0a69874c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_clean-1.2.5-cp310-abi3-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 377b85fa07cd6f5f06172a6ac7960092d83bb849476262132bbd1d8f6dfc439a
MD5 d3bad3b0c31e08bd620c289e579fc521
BLAKE2b-256 43fbb0a8b6466e432c6935b4ef73aec0980e901b79e48fed39d82304ae8b3ee9

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