aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEduardo Julian2016-02-14 23:04:43 -0400
committerEduardo Julian2016-02-14 23:04:43 -0400
commitd5e11bf452ed1b5ba8257777578c48234ffa6ac1 (patch)
tree74cf780a399ab79d08d46ce1396c00122f9e9101 /src
parente813726205a35ab3a38f9b42ed69d61e9202ac16 (diff)
- Updated the compiler version to 0.3.3.
- type->analysis can now handle ExQ. - Can now handle exponent syntax for reals. - Now adding v: and e: prefixes when showing type-vars and existential types, for improved readability.
Diffstat (limited to 'src')
-rw-r--r--src/lux/compiler/base.clj2
-rw-r--r--src/lux/compiler/type.clj10
-rw-r--r--src/lux/lexer.clj2
-rw-r--r--src/lux/type.clj4
4 files changed, 12 insertions, 6 deletions
diff --git a/src/lux/compiler/base.clj b/src/lux/compiler/base.clj
index b046b237f..b4c678b00 100644
--- a/src/lux/compiler/base.clj
+++ b/src/lux/compiler/base.clj
@@ -25,7 +25,7 @@
(java.lang.reflect Field)))
;; [Constants]
-(def ^String version "0.3.2")
+(def ^String version "0.3.3")
(def ^String input-dir "source")
(def ^String output-dir "target/jvm")
(def ^String output-package (str output-dir "/" "program.jar"))
diff --git a/src/lux/compiler/type.clj b/src/lux/compiler/type.clj
index 2b9542919..4576b33e6 100644
--- a/src/lux/compiler/type.clj
+++ b/src/lux/compiler/type.clj
@@ -13,7 +13,7 @@
;; [Utils]
(defn ^:private variant$ [tag body]
- "(-> Int Analysis Analysis)"
+ "(-> clojure.lang.Var Analysis Analysis)"
(let [tag-meta (meta tag)]
(&a/|meta &/$VoidT &/empty-cursor
(&a/$variant (::&/idx tag-meta) (::&/is-last? tag-meta) body))))
@@ -50,6 +50,7 @@
(variant$ #'&/$Cons (tuple$ (&/|list head tail))))
(defn ^:private List$ [elems]
+ "(-> (List Analysis) Analysis)"
(&/fold (fn [tail head]
(Cons$ head tail))
$Nil
@@ -83,6 +84,11 @@
(tuple$ (&/|list (List$ (&/|map type->analysis env))
(type->analysis body))))
+ (&/$ExQ env body)
+ (variant$ #'&/$ExQ
+ (tuple$ (&/|list (List$ (&/|map type->analysis env))
+ (type->analysis body))))
+
(&/$BoundT idx)
(variant$ #'&/$BoundT (int$ idx))
@@ -94,7 +100,7 @@
(type->analysis type*))))
_
- (assert false (prn 'type->analysis (&/adt->text type)))
+ (assert false (prn 'type->analysis (&type/show-type type)))
))
(defn ^:private defmetavalue->analysis [dmv]
diff --git a/src/lux/lexer.clj b/src/lux/lexer.clj
index bac8675de..772ce2353 100644
--- a/src/lux/lexer.clj
+++ b/src/lux/lexer.clj
@@ -121,7 +121,7 @@
^:private lex-bool $Bool #"^(true|false)"
^:private lex-int $Int #"^-?(0|[1-9][0-9]*)"
- ^:private lex-real $Real #"^-?(0\.[0-9]+|[1-9][0-9]*\.[0-9]+)"
+ ^:private lex-real $Real #"^-?(0\.[0-9]+|[1-9][0-9]*\.[0-9]+)(e-?[1-9][0-9]*)?"
)
(def ^:private lex-char
diff --git a/src/lux/type.clj b/src/lux/type.clj
index 9cb854c1e..8869b2577 100644
--- a/src/lux/type.clj
+++ b/src/lux/type.clj
@@ -389,10 +389,10 @@
(str "(-> " (->> ?ins (&/|map show-type) (&/|interpose " ") (&/fold str "")) " " (show-type ?out) ")"))
(&/$VarT id)
- (str "⌈" id "⌋")
+ (str "⌈v:" id "⌋")
(&/$ExT ?id)
- (str "⟨" ?id "⟩")
+ (str "⟨e:" ?id "⟩")
(&/$BoundT idx)
(str idx)