Actually save work

This commit is contained in:
Scott Richmond 2023-05-31 11:51:43 -04:00
parent 82a539a112
commit 67e230c714
3 changed files with 10 additions and 10 deletions

View File

@ -2,11 +2,11 @@
[x] Fix recursive definition problems in grammar.clj
TODOS from interpreter
[ ] implement tuple splat patterns
[ ] update match-list to use new AST representation
[ ] fix length comparison when pattern includes splats
[ ] update match-dict to use new AST representation
[ ] update match-struct to use new AST representation
[x] implement tuple splat patterns
[x] update match-list to use new AST representation
[x] fix length comparison when pattern includes splats
[x] update match-dict to use new AST representation
[x] update match-struct to use new AST representation
[ ] update interpret-receive to use new AST representation
[ ] Check interpret-fn-inner ctx for cycles/bugs

View File

@ -49,7 +49,7 @@
(defp typed group weak-order [:word (quiet :as) :keyword])
(defp dict-pattern-term flat choice [pair-pattern :word typed splattern])
(defp dict-pattern-term flat choice [pair-pattern typed :word splattern])
(defp dict-pattern-entry weak-order [dict-pattern-term separators])

View File

@ -193,7 +193,7 @@
splat-data (-> splat :data first)
splat-type (-> splat-data :type)]
(if (= :word splat-type)
(let [unmatched (assoc (apply dissoc dict kws) ::data/dict true)
(let [unmatched (apply dissoc dict kws)
match? (match splat-data unmatched ctx-diff)]
(if (:success match?)
{:success true :ctx (merge @ctx-diff (:ctx match?))}
@ -216,7 +216,7 @@
(not (map? dict))
{:success false :reason "Could not match non-struct value to struct pattern"}
(not (::data/dict dict))
(not (::data/struct dict))
{:success false :reason "Cannot match non-struct value to struct pattern"}
(empty? members)
@ -249,7 +249,7 @@
splat-data (-> splat :data first)
splat-type (-> splat-data :type)]
(if (= :word splat-type)
(let [unmatched (assoc (apply dissoc dict kws) ::data/dict true)
(let [unmatched (assoc (apply dissoc dict ::data/struct kws) ::data/dict true)
match? (match splat-data unmatched ctx-diff)]
(if (:success match?)
{:success true :ctx (merge @ctx-diff (:ctx match?))}
@ -961,7 +961,7 @@
(do
(def source "
let #{...x} = #{:a 1}
let @{...x} = @{:a 1, :b 2, :c 3}
x
")