diff options
author | Eduardo Julian | 2016-05-01 12:52:09 -0400 |
---|---|---|
committer | Eduardo Julian | 2016-05-01 12:52:09 -0400 |
commit | 057295d1521d4af54cf9ec97f1503f6ee5f010be (patch) | |
tree | 1fb02a10d835129877d595d49c00dd3c6a2703a2 | |
parent | 7dfe345dbc6bf3fc8ab20b34453fb3b8af3fa75c (diff) |
- Simplified the language by eliminating coercion and macro-declaration from the analysis type.
-rw-r--r-- | src/lux/analyser.clj | 2 | ||||
-rw-r--r-- | src/lux/analyser/base.clj | 2 | ||||
-rw-r--r-- | src/lux/analyser/lux.clj | 16 | ||||
-rw-r--r-- | src/lux/compiler.clj | 3 | ||||
-rw-r--r-- | src/lux/compiler/lux.clj | 3 | ||||
-rw-r--r-- | src/lux/optimizer.clj | 8 |
6 files changed, 11 insertions, 23 deletions
diff --git a/src/lux/analyser.clj b/src/lux/analyser.clj index 3256f6902..23cf19061 100644 --- a/src/lux/analyser.clj +++ b/src/lux/analyser.clj @@ -256,7 +256,7 @@ (&/$Cons ?type (&/$Cons ?value (&/$Nil))))) - (&&lux/analyse-check analyse eval! exo-type ?type ?value) + (&&lux/analyse-ann analyse eval! exo-type ?type ?value) (&/$FormS (&/$Cons [_ (&/$SymbolS _ "_lux_:!")] (&/$Cons ?type diff --git a/src/lux/analyser/base.clj b/src/lux/analyser/base.clj index c76274e76..933af3301 100644 --- a/src/lux/analyser/base.clj +++ b/src/lux/analyser/base.clj @@ -22,9 +22,7 @@ ("case" 2) ("lambda" 3) ("ann" 3) - ("coerce" 3) ("def" 3) - ("declare-macro" 1) ("var" 1) ("captured" 1) ("host" 2) diff --git a/src/lux/analyser/lux.clj b/src/lux/analyser/lux.clj index c0aefed35..9813e5497 100644 --- a/src/lux/analyser/lux.clj +++ b/src/lux/analyser/lux.clj @@ -578,22 +578,26 @@ _ (&&module/alias module-name ex-alias ex-module)] (return &/$Nil))) -(defn analyse-check [analyse eval! exo-type ?type ?value] +(defn analyse-ann [analyse eval! exo-type ?type ?value] (|do [=type (&&/analyse-1 analyse &type/Type ?type) ==type (eval! =type) _ (&type/check exo-type ==type) =value (&&/analyse-1 analyse ==type ?value) _cursor &/cursor] + ;; (analyse ==type ?value) (return (&/|list (&&/|meta ==type _cursor (&&/$ann =value =type ==type) ))))) +(defn ^:private coerce [new-type analysis] + "(-> Type Analysis Analysis)" + (|let [[[_type _cursor] _analysis] analysis] + (&&/|meta new-type _cursor + _analysis))) + (defn analyse-coerce [analyse eval! exo-type ?type ?value] (|do [=type (&&/analyse-1 analyse &type/Type ?type) ==type (eval! =type) _ (&type/check exo-type ==type) - =value (&&/analyse-1+ analyse ?value) - _cursor &/cursor] - (return (&/|list (&&/|meta ==type _cursor - (&&/$coerce =value =type ==type) - ))))) + =value (&&/analyse-1+ analyse ?value)] + (return (&/|list (coerce ==type =value))))) diff --git a/src/lux/compiler.clj b/src/lux/compiler.clj index e42f58f3f..2752d4f42 100644 --- a/src/lux/compiler.clj +++ b/src/lux/compiler.clj @@ -91,9 +91,6 @@ (&o/$ann ?value-ex ?type-ex ?value-type) (&&lux/compile-ann compile-expression ?value-ex ?type-ex ?value-type) - (&o/$coerce ?value-ex ?type-ex ?value-type) - (&&lux/compile-coerce compile-expression ?value-ex ?type-ex ?value-type) - (&o/$host [?proc-category ?proc-name] ?args) (&&host/compile-host compile-expression ?proc-category ?proc-name ?args) diff --git a/src/lux/compiler/lux.clj b/src/lux/compiler/lux.clj index 3b0ae5b29..ae6c2cdf5 100644 --- a/src/lux/compiler/lux.clj +++ b/src/lux/compiler/lux.clj @@ -237,6 +237,3 @@ (defn compile-ann [compile ?value-ex ?type-ex ?value-type] (compile ?value-ex)) - -(defn compile-coerce [compile ?value-ex ?type-ex ?value-type] - (compile ?value-ex)) diff --git a/src/lux/optimizer.clj b/src/lux/optimizer.clj index 09faa73fb..044a89ed6 100644 --- a/src/lux/optimizer.clj +++ b/src/lux/optimizer.clj @@ -21,9 +21,7 @@ ("case" 1) ("lambda" 1) ("ann" 1) - ("coerce" 1) ("def" 1) - ("declare-macro" 1) ("var" 1) ("captured" 1) ("host" 2) @@ -86,15 +84,9 @@ (&-base/$ann value) (return ($ann value)) - (&-base/$coerce value) - (return ($coerce value)) - (&-base/$def value) (return ($def value)) - (&-base/$declare-macro value) - (return ($declare-macro value)) - (&-base/$var value) (return ($var value)) |