From 8116f2ca62e14b8a25f5756c226ca3517766cd95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Madeleine=20Sydney=20=C5=9Alaga?= Date: Wed, 23 Sep 2026 14:57:29 -0600 Subject: [PATCH] --- src/expand.clj | 15 ++++++++++++++- src/scm.clj | 12 ++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/expand.clj b/src/expand.clj index 8db34bf..7c91693 100644 --- a/src/expand.clj +++ b/src/expand.clj @@ -256,7 +256,20 @@ (-> "t.scm" slurp (scm/read-syntax :library? true) - expand-library) + expand-library + ;; :library/declarations + ;; second + ;; second + ;; scm/syntax->datum + (update :library/declarations + (fn [decls] + (for [decl decls] + (match decl + [:begin & xs] (->> xs + (map scm/syntax->datum) + (cons :begin) + vec) + :else decl))))) (let [scopeholder (scm/new-scopeholder) env {[:global 'lambda] [:primitive 'lambda]} store-atom (atom {['lambda #{}] [:global 'lambda]})] diff --git a/src/scm.clj b/src/scm.clj index 574ee79..8b2d4a1 100644 --- a/src/scm.clj +++ b/src/scm.clj @@ -79,6 +79,18 @@ (assert (not (syntax? datum)) "너는 이렇고 싶은가…") (->Syntax datum (syntax-context ctxt-donor)))) +(declare improper-list?) + +(defn syntax->datum [stx] + (cond (syntax? stx) (recur (syntax-e stx)) + (seq? stx) (map syntax->datum stx) + (improper-list? stx) (throw (Exception. "todo")) + (or (constant? stx) (symbol? stx)) stx + :else (throw (ex-info + nil + {:stx stx} + (IllegalArgumentException. "이것으로 할 것을 몰라"))))) + (defn rescope [stx ctxt-donor] (->Syntax (syntax-e stx) (syntax-context ctxt-donor)))