ref->box everywhere
This commit is contained in:
parent
60106d10f0
commit
df85be3c1e
|
@ -345,7 +345,7 @@
|
||||||
(set (the-dict key) value))))
|
(set (the-dict key) value))))
|
||||||
the-dict)
|
the-dict)
|
||||||
|
|
||||||
(defn- ref [ast ctx]
|
(defn- box [ast ctx]
|
||||||
(def {:data value-ast :name name} ast)
|
(def {:data value-ast :name name} ast)
|
||||||
(def value (interpret value-ast ctx))
|
(def value (interpret value-ast ctx))
|
||||||
(def box @{:^type :box :^value value :name name})
|
(def box @{:^type :box :^value value :name name})
|
||||||
|
@ -595,7 +595,7 @@
|
||||||
# named/naming forms
|
# named/naming forms
|
||||||
:word (word ast ctx)
|
:word (word ast ctx)
|
||||||
:interpolated (interpolated ast ctx)
|
:interpolated (interpolated ast ctx)
|
||||||
:ref (ref ast ctx)
|
:box (box ast ctx)
|
||||||
:pkg (pkg ast ctx)
|
:pkg (pkg ast ctx)
|
||||||
:pkg-name (word ast ctx)
|
:pkg-name (word ast ctx)
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,9 @@
|
||||||
# (do
|
# (do
|
||||||
# (def start (os/clock))
|
# (def start (os/clock))
|
||||||
(def source `
|
(def source `
|
||||||
let foo = :bar
|
box foo = :bar
|
||||||
let first = 1
|
store! (foo, :baz)
|
||||||
|
unbox (foo)
|
||||||
`)
|
`)
|
||||||
(def out (-> source
|
(def out (-> source
|
||||||
ludus
|
ludus
|
||||||
|
|
|
@ -871,16 +871,16 @@
|
||||||
(array/push data (capture simple parser)))
|
(array/push data (capture simple parser)))
|
||||||
{:type :do :data data :token origin})
|
{:type :do :data data :token origin})
|
||||||
|
|
||||||
### refs, pkgs, nses, etc.
|
### boxs, pkgs, nses, etc.
|
||||||
(defn- ref [parser]
|
(defn- box [parser]
|
||||||
(def origin (current parser))
|
(def origin (current parser))
|
||||||
(expect parser :ref) (advance parser)
|
(expect parser :box) (advance parser)
|
||||||
(try
|
(try
|
||||||
(do
|
(do
|
||||||
(def name (-> parser word-only (get :data)))
|
(def name (-> parser word-only (get :data)))
|
||||||
(expect parser :equals) (advance parser)
|
(expect parser :equals) (advance parser)
|
||||||
(def value (nonbinding parser))
|
(def value (nonbinding parser))
|
||||||
{:type :ref :data value :name name :token origin})
|
{:type :box :data value :name name :token origin})
|
||||||
([err] err)))
|
([err] err)))
|
||||||
|
|
||||||
(defn- pkg-name [parser]
|
(defn- pkg-name [parser]
|
||||||
|
@ -1011,7 +1011,7 @@
|
||||||
### expressions
|
### expressions
|
||||||
# four levels of expression complexity:
|
# four levels of expression complexity:
|
||||||
# simple (atoms, collections, synthetic expressions; no conditionals or binding or blocks)
|
# simple (atoms, collections, synthetic expressions; no conditionals or binding or blocks)
|
||||||
# nonbinding (excludes let, ref, named fn: what is allowed inside collections)
|
# nonbinding (excludes let, box, named fn: what is allowed inside collections)
|
||||||
# plain old exprs (anything but toplevel)
|
# plain old exprs (anything but toplevel)
|
||||||
# toplevel (exprs + ns, pkg, test, import, use)
|
# toplevel (exprs + ns, pkg, test, import, use)
|
||||||
|
|
||||||
|
@ -1099,7 +1099,7 @@
|
||||||
# binding forms
|
# binding forms
|
||||||
:let (lett parser)
|
:let (lett parser)
|
||||||
:fn (fnn parser)
|
:fn (fnn parser)
|
||||||
:ref (ref parser)
|
:box (box parser)
|
||||||
|
|
||||||
# nonbinding forms
|
# nonbinding forms
|
||||||
:nil (nill parser)
|
:nil (nill parser)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
## see ludus-spec repo for more info
|
## see ludus-spec repo for more info
|
||||||
{
|
{
|
||||||
"as" :as ## impl
|
"as" :as ## impl
|
||||||
"box" :ref
|
"box" :box
|
||||||
"do" :do ## impl
|
"do" :do ## impl
|
||||||
"else" :else ## impl
|
"else" :else ## impl
|
||||||
"false" :false ## impl -> literal word
|
"false" :false ## impl -> literal word
|
||||||
|
|
|
@ -343,7 +343,7 @@ Deferred until a later iteration of Ludus:
|
||||||
(set (ast :arities) arities)
|
(set (ast :arities) arities)
|
||||||
validator)
|
validator)
|
||||||
|
|
||||||
(defn- ref [validator]
|
(defn- box [validator]
|
||||||
(def ast (validator :ast))
|
(def ast (validator :ast))
|
||||||
(def ctx (validator :ctx))
|
(def ctx (validator :ctx))
|
||||||
(def expr (ast :data))
|
(def expr (ast :data))
|
||||||
|
@ -757,7 +757,7 @@ Deferred until a later iteration of Ludus:
|
||||||
:use (usee validator)
|
:use (usee validator)
|
||||||
:loop (loopp validator)
|
:loop (loopp validator)
|
||||||
:recur (recur validator)
|
:recur (recur validator)
|
||||||
:ref (ref validator)
|
:box (box validator)
|
||||||
(error (string "unknown node type " type)))))
|
(error (string "unknown node type " type)))))
|
||||||
|
|
||||||
(set validate validate*)
|
(set validate validate*)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user