Skip to content

Add Chialisp (cl-26) language support#919

Open
darkverbito wants to merge 1 commit into
DeusData:mainfrom
darkverbito:add-chialisp-cl26
Open

Add Chialisp (cl-26) language support#919
darkverbito wants to merge 1 commit into
DeusData:mainfrom
darkverbito:add-chialisp-cl26

Conversation

@darkverbito

Copy link
Copy Markdown

What

Adds Chialisp (cl-26) as a first-class indexed language. Chialisp is the smart-contract language of the Chia blockchain — an s-expression language compiled to CLVM.

Grammar

A clean-room tree-sitter grammar — irulast/tree-sitter-chialisp (MIT). A generic s-expression core (list/symbol/number/hex/string/comment) authored against the clvm_tools_rs compiler frontend; parses the full cl-26 surface (mod, defun, defmacro, defconstant, assign, lambda, include, embed-file, namespace, …). Vendored under internal/cbm/vendored/grammars/chialisp/ per the MANIFEST convention (ABI 14).

Wiring (mirrors the existing Scheme lisp-family path — zero new extractor functions)

  • CBM_LANG_CHIALISP enum + lang_specs row (list/symbol node types); .clsp/.clib/.clinc extension mapping.
  • CBM_LANG_CHIALISP added to the four lisp-family extractor gates (extract_defs/extract_calls/extract_imports/extract_unified).

Chialisp-correct extraction

Chialisp differs from the generic lisp path in a few load-bearing ways:

  • def heads: defun, defun-inline, defmacro, defmac, defconstant, defconst, mod, namespace, export, embed-file, compile-file.
  • mod/export named by filename — their named_child(1) is the arg list, not a name.
  • CLVM primitive operators filtered from CALLS (the 49-entry clvm_tools_rs keyword table) so (sha256 …) / (+ …) / (c …) don't create phantom edges; sha256tree (a real defun) is kept.
  • dialect sigils (include *standard-cl-26*) are not import edges (they select a dialect, not a file); (include "x.clib") is.
  • quoted bodies (q …)/(quote …)/(qq …) are data — not descended.
  • embed-file/compile-file emit a Constant node + a file-dependency edge.

Verification

Indexed a 313-file cl-26 corpus (304 .clsp + 9 .clib): 514 Functions, 469 Constants; CALLS to real helpers only (zero primitive phantoms, sha256tree kept); imports to real .clib only (zero dialect-sigil phantoms). The grammar parses all 313 files with zero ERROR/MISSING nodes. Clean -Werror build; Scheme/Clojure/CommonLisp regression samples unchanged. MANIFEST.md updated (grammar entry + custom-handling row).

Chialisp is the smart-contract language of the Chia blockchain — an
s-expression language compiled to CLVM. This adds it as a first-class indexed
language.

Grammar: a clean-room tree-sitter grammar (github.com/irulast/tree-sitter-chialisp,
MIT) — a generic s-expression core (list/symbol/number/hex/string/comment)
authored against the clvm_tools_rs compiler frontend; parses the full cl-26
surface (mod / defun / defmacro / defconstant / assign / lambda / include /
embed-file / namespace / ...).

Wiring mirrors the existing Scheme lisp-family path (list/symbol nodes; zero new
extractor functions):
  - CBM_LANG_CHIALISP enum + lang_specs row; .clsp/.clib/.clinc extension mapping.
  - CBM_LANG_CHIALISP added to the four lisp-family extractor gates
    (extract_defs / extract_calls / extract_imports / extract_unified).

Chialisp-correct graph extraction:
  - def heads: defun, defun-inline, defmacro, defmac, defconstant, defconst, mod,
    namespace, export, embed-file, compile-file.
  - mod/export named by filename (their child(1) is the arg list, not a name).
  - CLVM primitive operators (the 49-entry clvm_tools_rs keyword table) filtered
    from CALLS, so (sha256 ...) / (+ ...) / (c ...) don't create phantom edges;
    sha256tree (a real defun) is kept.
  - dialect sigils (include *standard-cl-26*) are not import edges (they select a
    dialect, not a file); (include "x.clib") is.
  - quoted bodies (q ...)/(quote ...)/(qq ...) are data, not descended.
  - embed-file/compile-file emit a Constant node + a file-dependency edge.

Verified against a 313-file cl-26 corpus: 514 Functions, 469 Constants; CALLS to
real helpers only (zero primitive phantoms); imports to real .clib only (zero
dialect-sigil phantoms). Clean -Werror build; Scheme/Clojure/CommonLisp
regressions unchanged. MANIFEST.md updated (grammar entry + custom-handling row).
@darkverbito darkverbito requested a review from DeusData as a code owner July 6, 2026 16:00
@DeusData DeusData added enhancement New feature or request language-request Request for new language support parsing/quality Graph extraction bugs, false positives, missing edges priority/backlog Valuable contribution, lower scheduling urgency; review when maintainer capacity opens. labels Jul 7, 2026
@DeusData

DeusData commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Thanks for the Chialisp language-support PR. Triage: language request / parsing backlog.

Because this vendors a new grammar, review will check provenance, MIT license compatibility, generated parser scope, and that the wiring does not pull in unrelated code. The lisp-family extractor reuse is a good constraint; please keep the PR narrow around that.

@DeusData DeusData added this to the 0.9.2-rc milestone Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request language-request Request for new language support parsing/quality Graph extraction bugs, false positives, missing edges priority/backlog Valuable contribution, lower scheduling urgency; review when maintainer capacity opens.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants