diff options
author | Eduardo Julian | 2018-07-04 22:38:56 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-07-04 22:38:56 -0400 |
commit | 376ed521cd92c2c53f2e9cc3cb16b85b67e2fdea (patch) | |
tree | 338f244cf5e7b53dc43724c826285689481808b5 /luxc/src | |
parent | 4bc58162f3d381abf33c936eafc976a2f422258c (diff) |
- Re-named "degree" to "revolution".
Diffstat (limited to '')
-rw-r--r-- | luxc/src/lux/analyser.clj | 6 | ||||
-rw-r--r-- | luxc/src/lux/analyser/base.clj | 2 | ||||
-rw-r--r-- | luxc/src/lux/analyser/case.clj | 30 | ||||
-rw-r--r-- | luxc/src/lux/base.clj | 78 | ||||
-rw-r--r-- | luxc/src/lux/compiler/cache/ann.clj | 6 | ||||
-rw-r--r-- | luxc/src/lux/compiler/jvm.clj | 4 | ||||
-rw-r--r-- | luxc/src/lux/compiler/jvm/case.clj | 2 | ||||
-rw-r--r-- | luxc/src/lux/compiler/jvm/lux.clj | 2 | ||||
-rw-r--r-- | luxc/src/lux/lexer.clj | 6 | ||||
-rw-r--r-- | luxc/src/lux/optimizer.clj | 18 | ||||
-rw-r--r-- | luxc/src/lux/parser.clj | 4 | ||||
-rw-r--r-- | luxc/src/lux/type.clj | 8 | ||||
-rw-r--r-- | luxc/src/lux/type/host.clj | 2 |
13 files changed, 84 insertions, 84 deletions
diff --git a/luxc/src/lux/analyser.clj b/luxc/src/lux/analyser.clj index 641dfa947..56cb8a375 100644 --- a/luxc/src/lux/analyser.clj +++ b/luxc/src/lux/analyser.clj @@ -77,9 +77,9 @@ (|do [_ (&type/check exo-type &type/Int)] (return (&/|list (&&/|meta exo-type cursor (&&/$int ?value))))) - (&/$Deg ?value) - (|do [_ (&type/check exo-type &type/Deg)] - (return (&/|list (&&/|meta exo-type cursor (&&/$deg ?value))))) + (&/$Rev ?value) + (|do [_ (&type/check exo-type &type/Rev)] + (return (&/|list (&&/|meta exo-type cursor (&&/$rev ?value))))) (&/$Frac ?value) (|do [_ (&type/check exo-type &type/Frac)] diff --git a/luxc/src/lux/analyser/base.clj b/luxc/src/lux/analyser/base.clj index 5339f8777..25b73ba1a 100644 --- a/luxc/src/lux/analyser/base.clj +++ b/luxc/src/lux/analyser/base.clj @@ -9,7 +9,7 @@ ("bool" 1) ("nat" 1) ("int" 1) - ("deg" 1) + ("rev" 1) ("frac" 1) ("text" 1) ("variant" 3) diff --git a/luxc/src/lux/analyser/case.clj b/luxc/src/lux/analyser/case.clj index d5a6e43cf..86752d336 100644 --- a/luxc/src/lux/analyser/case.clj +++ b/luxc/src/lux/analyser/case.clj @@ -15,7 +15,7 @@ ("BoolTotal" 2) ("NatTotal" 2) ("IntTotal" 2) - ("DegTotal" 2) + ("RevTotal" 2) ("FracTotal" 2) ("TextTotal" 2) ("TupleTotal" 2) @@ -27,7 +27,7 @@ ("BoolTestAC" 1) ("NatTestAC" 1) ("IntTestAC" 1) - ("DegTestAC" 1) + ("RevTestAC" 1) ("FracTestAC" 1) ("TextTestAC" 1) ("TupleTestAC" 1) @@ -283,10 +283,10 @@ =kont kont] (return (&/T [($IntTestAC ?value) =kont]))) - (&/$Deg ?value) - (|do [_ (&type/check value-type &type/Deg) + (&/$Rev ?value) + (|do [_ (&type/check value-type &type/Rev) =kont kont] - (return (&/T [($DegTestAC ?value) =kont]))) + (return (&/T [($RevTestAC ?value) =kont]))) (&/$Frac ?value) (|do [_ (&type/check value-type &type/Frac) @@ -414,8 +414,8 @@ [($IntTotal total? ?values) ($NoTestAC)] (return ($IntTotal true ?values)) - [($DegTotal total? ?values) ($NoTestAC)] - (return ($DegTotal true ?values)) + [($RevTotal total? ?values) ($NoTestAC)] + (return ($RevTotal true ?values)) [($FracTotal total? ?values) ($NoTestAC)] (return ($FracTotal true ?values)) @@ -441,8 +441,8 @@ [($IntTotal total? ?values) ($StoreTestAC ?idx)] (return ($IntTotal true ?values)) - [($DegTotal total? ?values) ($StoreTestAC ?idx)] - (return ($DegTotal true ?values)) + [($RevTotal total? ?values) ($StoreTestAC ?idx)] + (return ($RevTotal true ?values)) [($FracTotal total? ?values) ($StoreTestAC ?idx)] (return ($FracTotal true ?values)) @@ -474,11 +474,11 @@ [($IntTotal total? ?values) ($IntTestAC ?value)] (return ($IntTotal total? (&/$Cons ?value ?values))) - [($DefaultTotal total?) ($DegTestAC ?value)] - (return ($DegTotal total? (&/|list ?value))) + [($DefaultTotal total?) ($RevTestAC ?value)] + (return ($RevTotal total? (&/|list ?value))) - [($DegTotal total? ?values) ($DegTestAC ?value)] - (return ($DegTotal total? (&/$Cons ?value ?values))) + [($RevTotal total? ?values) ($RevTestAC ?value)] + (return ($RevTotal total? (&/$Cons ?value ?values))) [($DefaultTotal total?) ($FracTestAC ?value)] (return ($FracTotal total? (&/|list ?value))) @@ -563,8 +563,8 @@ (|do [_ (&type/check value-type &type/Int)] (return ?total)) - ($DegTotal ?total _) - (|do [_ (&type/check value-type &type/Deg)] + ($RevTotal ?total _) + (|do [_ (&type/check value-type &type/Rev)] (return ?total)) ($FracTotal ?total _) diff --git a/luxc/src/lux/base.clj b/luxc/src/lux/base.clj index 1010bf418..37db2a480 100644 --- a/luxc/src/lux/base.clj +++ b/luxc/src/lux/base.clj @@ -74,7 +74,7 @@ ("Bool" 1) ("Nat" 1) ("Int" 1) - ("Deg" 1) + ("Rev" 1) ("Frac" 1) ("Text" 1) ("Symbol" 1) @@ -1086,12 +1086,12 @@ (fn [state] (return* state (get$ $cursor state)))) -(def deg-bits 64) +(def rev-bits 64) (let [clean-separators (fn [^String input] (.replaceAll input "_" "")) - deg-text-to-digits (fn [^String input] - (loop [output (vec (repeat deg-bits 0)) + rev-text-to-digits (fn [^String input] + (loop [output (vec (repeat rev-bits 0)) index (dec (.length input))] (if (>= index 0) (let [digit (Byte/parseByte (.substring input index (inc index)))] @@ -1108,50 +1108,50 @@ (int (/ raw 10)) (assoc digits index (rem raw 10)))) digits))) - deg-digit-power (fn [level] - (loop [output (-> (vec (repeat deg-bits 0)) + rev-digit-power (fn [level] + (loop [output (-> (vec (repeat rev-bits 0)) (assoc level 1)) times level] (if (>= times 0) (recur (times5 level output) (dec times)) output))) - deg-digits-lt (fn deg-digits-lt + rev-digits-lt (fn rev-digits-lt ([subject param index] - (and (< index deg-bits) + (and (< index rev-bits) (or (< (get subject index) (get param index)) (and (= (get subject index) (get param index)) - (deg-digits-lt subject param (inc index)))))) + (rev-digits-lt subject param (inc index)))))) ([subject param] - (deg-digits-lt subject param 0))) - deg-digits-sub-once (fn [subject param-digit index] + (rev-digits-lt subject param 0))) + rev-digits-sub-once (fn [subject param-digit index] (if (>= (get subject index) param-digit) (update-in subject [index] #(- % param-digit)) (recur (update-in subject [index] #(- 10 (- param-digit %))) 1 (dec index)))) - deg-digits-sub (fn [subject param] + rev-digits-sub (fn [subject param] (loop [target subject - index (dec deg-bits)] + index (dec rev-bits)] (if (>= index 0) - (recur (deg-digits-sub-once target (get param index) index) + (recur (rev-digits-sub-once target (get param index) index) (dec index)) target))) - deg-digits-to-text (fn [digits] + rev-digits-to-text (fn [digits] (loop [output "" - index (dec deg-bits)] + index (dec rev-bits)] (if (>= index 0) (recur (-> (get digits index) (Character/forDigit 10) (str output)) (dec index)) output))) - add-deg-digit-powers (fn [dl dr] - (loop [index (dec deg-bits) - output (vec (repeat deg-bits 0)) + add-rev-digit-powers (fn [dl dr] + (loop [index (dec rev-bits) + output (vec (repeat rev-bits 0)) carry 0] (if (>= index 0) (let [raw (+ carry @@ -1161,45 +1161,45 @@ (assoc output index (rem raw 10)) (int (/ raw 10)))) output)))] - ;; Based on the LuxRT.encode_deg method - (defn encode-deg [input] + ;; Based on the LuxRT.encode_rev method + (defn encode-rev [input] (if (= 0 input) ".0" - (loop [index (dec deg-bits) - output (vec (repeat deg-bits 0))] + (loop [index (dec rev-bits) + output (vec (repeat rev-bits 0))] (if (>= index 0) (recur (dec index) (if (bit-test input index) - (->> (- (dec deg-bits) index) - deg-digit-power - (add-deg-digit-powers output)) + (->> (- (dec rev-bits) index) + rev-digit-power + (add-rev-digit-powers output)) output)) - (-> output deg-digits-to-text + (-> output rev-digits-to-text (->> (str ".")) (.split "0*$") (aget 0)))))) - ;; Based on the LuxRT.decode_deg method - (defn decode-deg [^String input] + ;; Based on the LuxRT.decode_rev method + (defn decode-rev [^String input] (if (and (.startsWith input ".") - (< (.length input) (inc deg-bits))) + (< (.length input) (inc rev-bits))) (loop [digits-left (-> input (.substring 1) clean-separators - deg-text-to-digits) + rev-text-to-digits) index 0 ouput 0] - (if (< index deg-bits) - (let [power-slice (deg-digit-power index)] - (if (not (deg-digits-lt digits-left power-slice)) - (recur (deg-digits-sub digits-left power-slice) + (if (< index rev-bits) + (let [power-slice (rev-digit-power index)] + (if (not (rev-digits-lt digits-left power-slice)) + (recur (rev-digits-sub digits-left power-slice) (inc index) - (bit-set ouput (- (dec deg-bits) index))) + (bit-set ouput (- (dec rev-bits) index))) (recur digits-left (inc index) ouput))) ouput)) - (throw (str "Bad format for Deg number: " input)))) + (throw (str "Bad format for Rev number: " input)))) ) (defn show-ast [ast] @@ -1213,8 +1213,8 @@ [_ ($Int ?value)] (pr-str ?value) - [_ ($Deg ?value)] - (encode-deg ?value) + [_ ($Rev ?value)] + (encode-rev ?value) [_ ($Frac ?value)] (pr-str ?value) diff --git a/luxc/src/lux/compiler/cache/ann.clj b/luxc/src/lux/compiler/cache/ann.clj index 3111886ba..458146992 100644 --- a/luxc/src/lux/compiler/cache/ann.clj +++ b/luxc/src/lux/compiler/cache/ann.clj @@ -33,7 +33,7 @@ [_ (&/$Int value)] (str "I" value stop) - [_ (&/$Deg value)] + [_ (&/$Rev value)] (str "D" value stop) [_ (&/$Frac value)] @@ -79,7 +79,7 @@ ^:private deserialize-bool "B" &/$Bool Boolean/parseBoolean ^:private deserialize-nat "N" &/$Nat Long/parseLong ^:private deserialize-int "I" &/$Int Long/parseLong - ^:private deserialize-deg "D" &/$Deg Long/parseLong + ^:private deserialize-rev "D" &/$Rev Long/parseLong ^:private deserialize-frac "F" &/$Frac Double/parseDouble ^:private deserialize-text "T" &/$Text identity ) @@ -127,7 +127,7 @@ (or (deserialize-bool input) (deserialize-nat input) (deserialize-int input) - (deserialize-deg input) + (deserialize-rev input) (deserialize-frac input) (deserialize-text input) (deserialize-symbol input) diff --git a/luxc/src/lux/compiler/jvm.clj b/luxc/src/lux/compiler/jvm.clj index 68b0e15b7..a13427bc3 100644 --- a/luxc/src/lux/compiler/jvm.clj +++ b/luxc/src/lux/compiler/jvm.clj @@ -56,8 +56,8 @@ (&o/$int ?value) (&&lux/compile-int ?value) - (&o/$deg ?value) - (&&lux/compile-deg ?value) + (&o/$rev ?value) + (&&lux/compile-rev ?value) (&o/$frac ?value) (&&lux/compile-frac ?value) diff --git a/luxc/src/lux/compiler/jvm/case.clj b/luxc/src/lux/compiler/jvm/case.clj index 38f3ad4fc..79e6c559c 100644 --- a/luxc/src/lux/compiler/jvm/case.clj +++ b/luxc/src/lux/compiler/jvm/case.clj @@ -85,7 +85,7 @@ (.visitInsn Opcodes/LCMP) (.visitJumpInsn Opcodes/IFNE $else)) - (&o/$DegPM _value) + (&o/$RevPM _value) (doto writer stack-peek &&/unwrap-long diff --git a/luxc/src/lux/compiler/jvm/lux.clj b/luxc/src/lux/compiler/jvm/lux.clj index 32824a22d..6a85e1075 100644 --- a/luxc/src/lux/compiler/jvm/lux.clj +++ b/luxc/src/lux/compiler/jvm/lux.clj @@ -39,7 +39,7 @@ compile-nat "java/lang/Long" "J" long compile-int "java/lang/Long" "J" long - compile-deg "java/lang/Long" "J" long + compile-rev "java/lang/Long" "J" long compile-frac "java/lang/Double" "D" double ) diff --git a/luxc/src/lux/lexer.clj b/luxc/src/lux/lexer.clj index 84c925cbc..4ff0af4f2 100644 --- a/luxc/src/lux/lexer.clj +++ b/luxc/src/lux/lexer.clj @@ -12,7 +12,7 @@ ("Bool" 1) ("Nat" 1) ("Int" 1) - ("Deg" 1) + ("Rev" 1) ("Frac" 1) ("Text" 1) ("Symbol" 1) @@ -140,7 +140,7 @@ lex-nat $Nat #"^\+[0-9][0-9_]*" lex-int $Int #"^-?[0-9][0-9_]*" - lex-deg $Deg #"^\.[0-9][0-9_]+" + lex-rev $Rev #"^\.[0-9][0-9_]+" lex-frac $Frac #"^-?[0-9][0-9_]*\.[0-9_]+((e|E)(-|\+)?[0-9][0-9_]*)?" ) @@ -208,7 +208,7 @@ lex-bool lex-nat lex-frac - lex-deg + lex-rev lex-int lex-text lex-symbol diff --git a/luxc/src/lux/optimizer.clj b/luxc/src/lux/optimizer.clj index 25958712f..8f331cc95 100644 --- a/luxc/src/lux/optimizer.clj +++ b/luxc/src/lux/optimizer.clj @@ -9,7 +9,7 @@ ("bool" 1) ("nat" 1) ("int" 1) - ("deg" 1) + ("rev" 1) ("frac" 1) ("text" 1) ("variant" 3) @@ -71,8 +71,8 @@ ("NatPM" 1) ;; Compare the CDN with an integer value. ("IntPM" 1) - ;; Compare the CDN with a degree value. - ("DegPM" 1) + ;; Compare the CDN with a revolution value. + ("RevPM" 1) ;; Compare the CDN with a frac value. ("FracPM" 1) ;; Compare the CDN with a text value. @@ -186,8 +186,8 @@ (&/|list ($IntPM _value) $PopPM) - (&a-case/$DegTestAC _value) - (&/|list ($DegPM _value) + (&a-case/$RevTestAC _value) + (&/|list ($RevPM _value) $PopPM) (&a-case/$FracTestAC _value) @@ -290,9 +290,9 @@ ($IntPM _pre-value) ($AltPM pre post)) - [($DegPM _pre-value) ($DegPM _post-value)] + [($RevPM _pre-value) ($RevPM _post-value)] (if (= _pre-value _post-value) - ($DegPM _pre-value) + ($RevPM _pre-value) ($AltPM pre post)) [($FracPM _pre-value) ($FracPM _post-value)] @@ -1010,8 +1010,8 @@ (&a/$int value) (&/T [meta ($int value)]) - (&a/$deg value) - (&/T [meta ($deg value)]) + (&a/$rev value) + (&/T [meta ($rev value)]) (&a/$frac value) (&/T [meta ($frac value)]) diff --git a/luxc/src/lux/parser.clj b/luxc/src/lux/parser.clj index 6bc2190a7..130a794ac 100644 --- a/luxc/src/lux/parser.clj +++ b/luxc/src/lux/parser.clj @@ -73,8 +73,8 @@ (&lexer/$Int ?value) (return (&/|list (&/T [meta (&/$Int (Long/parseLong ?value))]))) - (&lexer/$Deg ?value) - (return (&/|list (&/T [meta (&/$Deg (&/decode-deg ?value))]))) + (&lexer/$Rev ?value) + (return (&/|list (&/T [meta (&/$Rev (&/decode-rev ?value))]))) (&lexer/$Frac ?value) (return (&/|list (&/T [meta (&/$Frac (Double/parseDouble ?value))]))) diff --git a/luxc/src/lux/type.clj b/luxc/src/lux/type.clj index 173f144b9..d0fcf4691 100644 --- a/luxc/src/lux/type.clj +++ b/luxc/src/lux/type.clj @@ -27,12 +27,12 @@ (&/$UnivQ empty-env (&/$Primitive "#I64" (&/|list (&/$Parameter 1)))))) (def Nat* (&/$Primitive &&host/nat-data-tag &/$Nil)) -(def Deg* (&/$Primitive &&host/deg-data-tag &/$Nil)) +(def Rev* (&/$Primitive &&host/rev-data-tag &/$Nil)) (def Int* (&/$Primitive &&host/int-data-tag &/$Nil)) (def Bool (&/$Named (&/T ["lux" "Bool"]) (&/$Primitive "#Bool" &/$Nil))) (def Nat (&/$Named (&/T ["lux" "Nat"]) (&/$Apply Nat* I64))) -(def Deg (&/$Named (&/T ["lux" "Deg"]) (&/$Apply Deg* I64))) +(def Rev (&/$Named (&/T ["lux" "Rev"]) (&/$Apply Rev* I64))) (def Int (&/$Named (&/T ["lux" "Int"]) (&/$Apply Int* I64))) (def Frac (&/$Named (&/T ["lux" "Frac"]) (&/$Primitive "#Frac" &/$Nil))) (def Text (&/$Named (&/T ["lux" "Text"]) (&/$Primitive "#Text" &/$Nil))) @@ -154,8 +154,8 @@ Nat (&/$Sum ;; "lux;Int" Int - (&/$Sum ;; "lux;Deg" - Deg + (&/$Sum ;; "lux;Rev" + Rev (&/$Sum ;; "lux;Frac" Frac (&/$Sum ;; "lux;Text" diff --git a/luxc/src/lux/type/host.clj b/luxc/src/lux/type/host.clj index bdf0d7b50..474153316 100644 --- a/luxc/src/lux/type/host.clj +++ b/luxc/src/lux/type/host.clj @@ -69,7 +69,7 @@ (def i64-data-tag "#I64") (def nat-data-tag "#Nat") (def int-data-tag "#Int") -(def deg-data-tag "#Deg") +(def rev-data-tag "#Rev") ;; [Utils] (defn ^:private trace-lineage* [^Class super-class ^Class sub-class] |