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.3.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.3-cp310-abi3-manylinux_2_39_x86_64.whl (762.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.3.tar.gz.

File metadata

  • Download URL: tree_sitter_clean-1.2.3.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.3.tar.gz
Algorithm Hash digest
SHA256 b899e471abcab708ed9b2b13b10ef7c1e447f569fcacad70c3dea86c5d76cba2
MD5 a51fc69d21e7556a0b5530501e136f4a
BLAKE2b-256 55e06568e31b867a8d015df989d24a2becbea8b078723f8e186b66139cae0a73

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tree_sitter_clean-1.2.3-cp310-abi3-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 908c61857faabc4a2b3d68e8b64873d3377d870d8de5b1e0a6205089e8705659
MD5 e594b758de312f8790109f588ee9ce4b
BLAKE2b-256 3e11de7f93ea491e41872509a6bd70c7ada204b7f9e0534e5fd45ad78fed9a28

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