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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant