Update notes
This commit is contained in:
parent
85f7bc8c08
commit
d924b5fa6f
|
@ -83,7 +83,7 @@
|
||||||
success (:success match)]
|
success (:success match)]
|
||||||
(if success
|
(if success
|
||||||
(swap! ctx update-ctx (:ctx match))
|
(swap! ctx update-ctx (:ctx match))
|
||||||
(throw (new Exception (:reason match))))
|
(throw (ex-info (:reason match) {})))
|
||||||
value
|
value
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@ -144,7 +144,13 @@
|
||||||
:body +
|
: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]
|
(defn- call-fn [fn tuple ctx]
|
||||||
(let [passed (interpret tuple ctx)]
|
(let [passed (interpret tuple ctx)]
|
||||||
|
@ -250,7 +256,8 @@
|
||||||
|
|
||||||
(def source "
|
(def source "
|
||||||
add (1, 2, 3)
|
add (1, 2, 3)
|
||||||
")
|
|
||||||
|
")
|
||||||
|
|
||||||
(println "")
|
(println "")
|
||||||
(println "****************************************")
|
(println "****************************************")
|
||||||
|
@ -264,3 +271,17 @@
|
||||||
(interpret {})
|
(interpret {})
|
||||||
(pp/pprint)
|
(pp/pprint)
|
||||||
))
|
))
|
||||||
|
|
||||||
|
(comment "
|
||||||
|
|
||||||
|
Left to do:
|
||||||
|
* if-let pattern
|
||||||
|
* improve panics
|
||||||
|
* add location info for panics
|
||||||
|
|
||||||
|
")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -565,9 +565,7 @@
|
||||||
|
|
||||||
(do
|
(do
|
||||||
(def pp pp/pprint)
|
(def pp pp/pprint)
|
||||||
(def source "match foo with {
|
(def source "match foo with _ -> foo
|
||||||
0 -> foo
|
|
||||||
}
|
|
||||||
|
|
||||||
")
|
")
|
||||||
(def lexed (scanner/scan source))
|
(def lexed (scanner/scan source))
|
||||||
|
@ -589,18 +587,30 @@
|
||||||
|
|
||||||
(comment "
|
(comment "
|
||||||
Further thoughts/still to do:
|
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
|
* AST nodes should include tokens/locations
|
||||||
- at current, only atoms do this
|
- at current, only atoms do this
|
||||||
* Improve error handling in hashmap parsing
|
* Improve error handling in hashmap parsing
|
||||||
*
|
* Consider error handling in match expressions
|
||||||
|
* Add treatment of ignored variables
|
||||||
Other quick thoughts:
|
|
||||||
|
|
||||||
* Placeholders
|
* Placeholders
|
||||||
|
* How much in parser, how much in analysis?
|
||||||
* Does this want to happen in parsing or in analysis?
|
|
||||||
|
|
||||||
For future correctness checks:
|
|
||||||
|
|
||||||
")
|
")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user