Update notes

This commit is contained in:
Scott Richmond 2022-03-20 16:15:07 -04:00
parent 85f7bc8c08
commit d924b5fa6f
2 changed files with 47 additions and 16 deletions

View File

@ -83,7 +83,7 @@
success (:success match)]
(if success
(swap! ctx update-ctx (:ctx match))
(throw (new Exception (:reason match))))
(throw (ex-info (:reason match) {})))
value
))
@ -144,7 +144,13 @@
:body +
})
(def prelude {"eq" eq "add" add})
(def panic {
:name "panic"
::ast/type ::ast/clj
:body (fn [msg & _] (throw (ex-info msg {})))
})
(def prelude {"eq" eq "add" add "panic" panic})
(defn- call-fn [fn tuple ctx]
(let [passed (interpret tuple ctx)]
@ -250,7 +256,8 @@
(def source "
add (1, 2, 3)
")
")
(println "")
(println "****************************************")
@ -263,4 +270,18 @@
(::parser/ast)
(interpret {})
(pp/pprint)
))
))
(comment "
Left to do:
* if-let pattern
* improve panics
* add location info for panics
")

View File

@ -565,9 +565,7 @@
(do
(def pp pp/pprint)
(def source "match foo with {
0 -> foo
}
(def source "match foo with _ -> foo
")
(def lexed (scanner/scan source))
@ -589,18 +587,30 @@
(comment "
Further thoughts/still to do:
* Functions
* anonymous, simple
* named, simple
* anonymous, complex?
* named, complex
* with docstrings?
* Cond expressions
* Loops
* Structs
* Namespaces
* Types (:|)
* Modules
* Add `as` clauses to patterns
* Add `when` clauses to patterns
* var/mut
* ref/swap
* Splats in lists, hashmaps, sets
* AST nodes should include tokens/locations
- at current, only atoms do this
* Improve error handling in hashmap parsing
*
Other quick thoughts:
* Placeholders
* Does this want to happen in parsing or in analysis?
For future correctness checks:
* Consider error handling in match expressions
* Add treatment of ignored variables
* Placeholders
* How much in parser, how much in analysis?
")