aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEduardo Julian2015-09-11 19:46:30 -0400
committerEduardo Julian2015-09-11 19:46:30 -0400
commit5a26c40dc215dfb22a77cad28455deff28ca9976 (patch)
tree2b2af63d2d6b5a68df72f65f4f570f8f0531d347 /src
parent113143d5d2e86185a8fca5214cfa57b4456bfbbb (diff)
- Implemented the with-open macro.
- Cleaned-up a bit the tag-generation macro "deftags".
Diffstat (limited to 'src')
-rw-r--r--src/lux/analyser/base.clj226
-rw-r--r--src/lux/analyser/case.clj36
-rw-r--r--src/lux/analyser/module.clj13
-rw-r--r--src/lux/base.clj127
-rw-r--r--src/lux/lexer.clj32
-rw-r--r--src/lux/reader.clj8
6 files changed, 221 insertions, 221 deletions
diff --git a/src/lux/analyser/base.clj b/src/lux/analyser/base.clj
index 1507a3a76..0bb40c71b 100644
--- a/src/lux/analyser/base.clj
+++ b/src/lux/analyser/base.clj
@@ -10,120 +10,118 @@
[type :as &type])))
;; [Tags]
-(deftags ""
- "bool"
- "int"
- "real"
- "char"
- "text"
- "variant"
- "tuple"
- "apply"
- "case"
- "lambda"
- "ann"
- "def"
- "declare-macro"
- "var"
- "captured"
-
- "jvm-getstatic"
- "jvm-getfield"
- "jvm-putstatic"
- "jvm-putfield"
- "jvm-invokestatic"
- "jvm-instanceof"
- "jvm-invokevirtual"
- "jvm-invokeinterface"
- "jvm-invokespecial"
- "jvm-null?"
- "jvm-null"
- "jvm-new"
- "jvm-new-array"
- "jvm-aastore"
- "jvm-aaload"
- "jvm-class"
- "jvm-interface"
- "jvm-try"
- "jvm-throw"
- "jvm-monitorenter"
- "jvm-monitorexit"
- "jvm-program"
-
- "jvm-iadd"
- "jvm-isub"
- "jvm-imul"
- "jvm-idiv"
- "jvm-irem"
- "jvm-ieq"
- "jvm-ilt"
- "jvm-igt"
-
- "jvm-ceq"
- "jvm-clt"
- "jvm-cgt"
-
- "jvm-ladd"
- "jvm-lsub"
- "jvm-lmul"
- "jvm-ldiv"
- "jvm-lrem"
- "jvm-leq"
- "jvm-llt"
- "jvm-lgt"
-
- "jvm-fadd"
- "jvm-fsub"
- "jvm-fmul"
- "jvm-fdiv"
- "jvm-frem"
- "jvm-feq"
- "jvm-flt"
- "jvm-fgt"
-
- "jvm-dadd"
- "jvm-dsub"
- "jvm-dmul"
- "jvm-ddiv"
- "jvm-drem"
- "jvm-deq"
- "jvm-dlt"
- "jvm-dgt"
-
- "jvm-d2f"
- "jvm-d2i"
- "jvm-d2l"
-
- "jvm-f2d"
- "jvm-f2i"
- "jvm-f2l"
-
- "jvm-i2b"
- "jvm-i2c"
- "jvm-i2d"
- "jvm-i2f"
- "jvm-i2l"
- "jvm-i2s"
-
- "jvm-l2d"
- "jvm-l2f"
- "jvm-l2i"
-
- "jvm-iand"
- "jvm-ior"
- "jvm-ixor"
- "jvm-ishl"
- "jvm-ishr"
- "jvm-iushr"
-
- "jvm-land"
- "jvm-lor"
- "jvm-lxor"
- "jvm-lshl"
- "jvm-lshr"
- "jvm-lushr"
-
- )
+(deftags
+ ["bool"
+ "int"
+ "real"
+ "char"
+ "text"
+ "variant"
+ "tuple"
+ "apply"
+ "case"
+ "lambda"
+ "ann"
+ "def"
+ "declare-macro"
+ "var"
+ "captured"
+
+ "jvm-getstatic"
+ "jvm-getfield"
+ "jvm-putstatic"
+ "jvm-putfield"
+ "jvm-invokestatic"
+ "jvm-instanceof"
+ "jvm-invokevirtual"
+ "jvm-invokeinterface"
+ "jvm-invokespecial"
+ "jvm-null?"
+ "jvm-null"
+ "jvm-new"
+ "jvm-new-array"
+ "jvm-aastore"
+ "jvm-aaload"
+ "jvm-class"
+ "jvm-interface"
+ "jvm-try"
+ "jvm-throw"
+ "jvm-monitorenter"
+ "jvm-monitorexit"
+ "jvm-program"
+
+ "jvm-iadd"
+ "jvm-isub"
+ "jvm-imul"
+ "jvm-idiv"
+ "jvm-irem"
+ "jvm-ieq"
+ "jvm-ilt"
+ "jvm-igt"
+
+ "jvm-ceq"
+ "jvm-clt"
+ "jvm-cgt"
+
+ "jvm-ladd"
+ "jvm-lsub"
+ "jvm-lmul"
+ "jvm-ldiv"
+ "jvm-lrem"
+ "jvm-leq"
+ "jvm-llt"
+ "jvm-lgt"
+
+ "jvm-fadd"
+ "jvm-fsub"
+ "jvm-fmul"
+ "jvm-fdiv"
+ "jvm-frem"
+ "jvm-feq"
+ "jvm-flt"
+ "jvm-fgt"
+
+ "jvm-dadd"
+ "jvm-dsub"
+ "jvm-dmul"
+ "jvm-ddiv"
+ "jvm-drem"
+ "jvm-deq"
+ "jvm-dlt"
+ "jvm-dgt"
+
+ "jvm-d2f"
+ "jvm-d2i"
+ "jvm-d2l"
+
+ "jvm-f2d"
+ "jvm-f2i"
+ "jvm-f2l"
+
+ "jvm-i2b"
+ "jvm-i2c"
+ "jvm-i2d"
+ "jvm-i2f"
+ "jvm-i2l"
+ "jvm-i2s"
+
+ "jvm-l2d"
+ "jvm-l2f"
+ "jvm-l2i"
+
+ "jvm-iand"
+ "jvm-ior"
+ "jvm-ixor"
+ "jvm-ishl"
+ "jvm-ishr"
+ "jvm-iushr"
+
+ "jvm-land"
+ "jvm-lor"
+ "jvm-lxor"
+ "jvm-lshl"
+ "jvm-lshr"
+ "jvm-lushr"])
;; [Exports]
(defn expr-type* [syntax+]
diff --git a/src/lux/analyser/case.clj b/src/lux/analyser/case.clj
index 7226b98e4..a0f07cdce 100644
--- a/src/lux/analyser/case.clj
+++ b/src/lux/analyser/case.clj
@@ -15,26 +15,26 @@
[record :as &&record])))
;; [Tags]
-(deftags ""
- "DefaultTotal"
- "BoolTotal"
- "IntTotal"
- "RealTotal"
- "CharTotal"
- "TextTotal"
- "TupleTotal"
- "VariantTotal"
+(deftags
+ ["DefaultTotal"
+ "BoolTotal"
+ "IntTotal"
+ "RealTotal"
+ "CharTotal"
+ "TextTotal"
+ "TupleTotal"
+ "VariantTotal"]
)
-(deftags ""
- "StoreTestAC"
- "BoolTestAC"
- "IntTestAC"
- "RealTestAC"
- "CharTestAC"
- "TextTestAC"
- "TupleTestAC"
- "VariantTestAC"
+(deftags
+ ["StoreTestAC"
+ "BoolTestAC"
+ "IntTestAC"
+ "RealTestAC"
+ "CharTestAC"
+ "TextTestAC"
+ "TupleTestAC"
+ "VariantTestAC"]
)
;; [Utils]
diff --git a/src/lux/analyser/module.clj b/src/lux/analyser/module.clj
index aaed26a7a..6740d6515 100644
--- a/src/lux/analyser/module.clj
+++ b/src/lux/analyser/module.clj
@@ -14,12 +14,13 @@
[host :as &host])))
;; [Utils]
-(deftags ""
- "module-aliases"
- "defs"
- "imports"
- "tags"
- "types")
+(deftags
+ ["module-aliases"
+ "defs"
+ "imports"
+ "tags"
+ "types"])
+
(def ^:private +init+
(&/T ;; "lux;module-aliases"
(&/|table)
diff --git a/src/lux/base.clj b/src/lux/base.clj
index 4db1d26bc..c0f28f519 100644
--- a/src/lux/base.clj
+++ b/src/lux/base.clj
@@ -9,93 +9,94 @@
clojure.core.match.array))
;; [Tags]
-(defmacro deftags [prefix & names]
+(defmacro deftags [names]
+ (assert (vector? names))
`(do ~@(for [[name idx] (map vector names (range (count names)))]
`(def ~(symbol (str "$" name)) ~idx))))
;; List
-(deftags ""
- "Nil"
- "Cons")
+(deftags
+ ["Nil"
+ "Cons"])
;; Maybe
-(deftags ""
- "None"
- "Some")
+(deftags
+ ["None"
+ "Some"])
;; Either
-(deftags ""
- "Left"
- "Right")
+(deftags
+ ["Left"
+ "Right"])
;; AST
-(deftags ""
- "BoolS"
- "IntS"
- "RealS"
- "CharS"
- "TextS"
- "SymbolS"
- "TagS"
- "FormS"
- "TupleS"
- "RecordS")
+(deftags
+ ["BoolS"
+ "IntS"
+ "RealS"
+ "CharS"
+ "TextS"
+ "SymbolS"
+ "TagS"
+ "FormS"
+ "TupleS"
+ "RecordS"])
;; Type
-(deftags ""
- "DataT"
- "VariantT"
- "TupleT"
- "LambdaT"
- "BoundT"
- "VarT"
- "ExT"
- "UnivQ"
- "ExQ"
- "AppT"
- "NamedT")
+(deftags
+ ["DataT"
+ "VariantT"
+ "TupleT"
+ "LambdaT"
+ "BoundT"
+ "VarT"
+ "ExT"
+ "UnivQ"
+ "ExQ"
+ "AppT"
+ "NamedT"])
;; Vars
-(deftags "lux;"
- "Local"
- "Global")
+(deftags
+ ["Local"
+ "Global"])
;; Definitions
-(deftags "lux;"
- "ValueD"
- "TypeD"
- "MacroD"
- "AliasD")
+(deftags
+ ["ValueD"
+ "TypeD"
+ "MacroD"
+ "AliasD"])
;; Binding
-(deftags ""
- "counter"
- "mappings")
+(deftags
+ ["counter"
+ "mappings"])
;; Env
-(deftags ""
- "name"
- "inner-closures"
- "locals"
- "closure")
+(deftags
+ ["name"
+ "inner-closures"
+ "locals"
+ "closure"])
;; Host
-(deftags ""
- "writer"
- "loader"
- "classes")
+(deftags
+ ["writer"
+ "loader"
+ "classes"])
;; Compiler
-(deftags ""
- "source"
- "cursor"
- "modules"
- "envs"
- "type-vars"
- "expected"
- "seed"
- "eval?"
- "host")
+(deftags
+ ["source"
+ "cursor"
+ "modules"
+ "envs"
+ "type-vars"
+ "expected"
+ "seed"
+ "eval?"
+ "host"])
;; [Exports]
(def datum-field "_datum")
diff --git a/src/lux/lexer.clj b/src/lux/lexer.clj
index b3a47f3e0..fd694c51c 100644
--- a/src/lux/lexer.clj
+++ b/src/lux/lexer.clj
@@ -10,22 +10,22 @@
[lux.analyser.module :as &module]))
;; [Tags]
-(deftags ""
- "White_Space"
- "Comment"
- "Bool"
- "Int"
- "Real"
- "Char"
- "Text"
- "Symbol"
- "Tag"
- "Open_Paren"
- "Close_Paren"
- "Open_Bracket"
- "Close_Bracket"
- "Open_Brace"
- "Close_Brace"
+(deftags
+ ["White_Space"
+ "Comment"
+ "Bool"
+ "Int"
+ "Real"
+ "Char"
+ "Text"
+ "Symbol"
+ "Tag"
+ "Open_Paren"
+ "Close_Paren"
+ "Open_Bracket"
+ "Close_Bracket"
+ "Open_Brace"
+ "Close_Brace"]
)
;; [Utils]
diff --git a/src/lux/reader.clj b/src/lux/reader.clj
index 7b1559f07..751df7e6d 100644
--- a/src/lux/reader.clj
+++ b/src/lux/reader.clj
@@ -10,10 +10,10 @@
[lux.base :as & :refer [deftags |do return* return fail fail* |let |case]]))
;; [Tags]
-(deftags ""
- "No"
- "Done"
- "Yes")
+(deftags
+ ["No"
+ "Done"
+ "Yes"])
;; [Utils]
(defn ^:private with-line [body]