This commit is contained in:
1 parent
29b7f46dae
commit
8116f2ca62
2 files changed
+26
-1
No files matched your search
+14
-1
@@ -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]})]
|
||||
|
||||
+12
@@ -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)))
|
||||
|
||||
|
||||
Reference in new issue
Block a user