Add Chialisp (cl-26) language support#919
Open
darkverbito wants to merge 1 commit into
Open
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 theclvm_tools_rscompiler frontend; parses the full cl-26 surface (mod,defun,defmacro,defconstant,assign,lambda,include,embed-file,namespace, …). Vendored underinternal/cbm/vendored/grammars/chialisp/per the MANIFEST convention (ABI 14).Wiring (mirrors the existing Scheme lisp-family path — zero new extractor functions)
CBM_LANG_CHIALISPenum +lang_specsrow (list/symbolnode types);.clsp/.clib/.clincextension mapping.CBM_LANG_CHIALISPadded 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:
defun,defun-inline,defmacro,defmac,defconstant,defconst,mod,namespace,export,embed-file,compile-file.mod/exportnamed by filename — theirnamed_child(1)is the arg list, not a name.clvm_tools_rskeyword table) so(sha256 …)/(+ …)/(c …)don't create phantom edges;sha256tree(a real defun) is kept.(include *standard-cl-26*)are not import edges (they select a dialect, not a file);(include "x.clib")is.(q …)/(quote …)/(qq …)are data — not descended.embed-file/compile-fileemit aConstantnode + 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,sha256treekept); imports to real.clibonly (zero dialect-sigil phantoms). The grammar parses all 313 files with zero ERROR/MISSING nodes. Clean-Werrorbuild; Scheme/Clojure/CommonLisp regression samples unchanged.MANIFEST.mdupdated (grammar entry + custom-handling row).