diff options
Diffstat (limited to '')
29 files changed, 71 insertions, 70 deletions
diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el index c72a1f76e..c888df739 100644 --- a/lux-mode/lux-mode.el +++ b/lux-mode/lux-mode.el @@ -217,7 +217,7 @@ Called by `imenu--generic-function'." (concat "#" normal)) (defconst lux-font-lock-keywords - (let ((natural "[0-9][0-9_]*") + (let ((natural "[0-9][0-9,]*") (identifier_h "[a-zA-Z-\\+_=!@\\$%\\^&\\*<>;,/\\\\\\|':~\\?]") (identifier_t "[a-zA-Z0-9-\\+_=!@\\$%\\^&\\*<>;,/\\\\\\|':~\\?]") (sign (altRE "-" "\\+"))) diff --git a/luxc/src/lux/lexer.clj b/luxc/src/lux/lexer.clj index 8ed75b940..962e1e9bd 100644 --- a/luxc/src/lux/lexer.clj +++ b/luxc/src/lux/lexer.clj @@ -57,12 +57,12 @@ (do-template [<name> <tag> <regex>] (def <name> (|do [[meta _ token] (&reader/read-regex <regex>)] - (return (&/T [meta (<tag> (string/replace token #"_" ""))])))) + (return (&/T [meta (<tag> (string/replace token #"," ""))])))) - lex-nat $Nat #"^[0-9][0-9_]*" - lex-int $Int #"^(-|\+)[0-9][0-9_]*" - lex-rev $Rev #"^\.[0-9][0-9_]*" - lex-frac $Frac #"^(-|\+)[0-9][0-9_]*\.[0-9][0-9_]*((e|E)(-|\+)[0-9][0-9_]*)?" + lex-nat $Nat #"^[0-9][0-9,]*" + lex-int $Int #"^(-|\+)[0-9][0-9,]*" + lex-rev $Rev #"^\.[0-9][0-9,]*" + lex-frac $Frac #"^(-|\+)[0-9][0-9,]*\.[0-9][0-9,]*((e|E)(-|\+)[0-9][0-9,]*)?" ) (def +same-module-mark+ (str &/+name-separator+ &/+name-separator+)) diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux index 3e8d2c514..1f06130e4 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux @@ -290,7 +290,7 @@ (runtime: (io//current-time _) (|> _.get-universal-time - (_.* (_.int 1_000)))) + (_.* (_.int 1,000)))) (def: runtime//io (_.progn (list @@io//exit diff --git a/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux index f173f24b6..94337001e 100644 --- a/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux @@ -283,7 +283,7 @@ (def: (io//current-time []) Nullary (|> (lua.apply "os.time" (list)) - (lua.* (lua.int 1_000)))) + (lua.* (lua.int 1,000)))) ## [Bundles] (def: lux-procs diff --git a/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux index d33cdb76c..3d5ea1775 100644 --- a/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux @@ -146,7 +146,7 @@ ## (_.import! "time") ## (_.return! (let [time (|> (_.global "time") ## (_.send (list) "time") -## (_.* (_.int 1_000)))] +## (_.* (_.int 1,000)))] ## (_.apply (list time) (_.global "int")))))) ## (def: runtime//io diff --git a/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux index 2cfe7eb1e..e5beb9872 100644 --- a/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux @@ -147,7 +147,7 @@ (python.import! "time") (python.return! (let [time (|> (python.global "time") (python.send (list) "time") - (python.* (python.int 1_000)))] + (python.* (python.int 1,000)))] (python.apply (list time) (python.global "int")))))) (def: runtime//io diff --git a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux index dff7c4ae1..ce2265a8e 100644 --- a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux @@ -514,7 +514,7 @@ (runtime: (io//current-time! _) (|> current-time-float - (r.* (r.float 1_000.0)) + (r.* (r.float 1,000.0)) int//from-float)) (def: runtime//io diff --git a/stdlib/source/lux/data/collection/list.lux b/stdlib/source/lux/data/collection/list.lux index 6d3b4cf85..a6b12b670 100644 --- a/stdlib/source/lux/data/collection/list.lux +++ b/stdlib/source/lux/data/collection/list.lux @@ -437,7 +437,7 @@ pattern (` [(~+ (map (function (_ [v vs]) (` (#.Cons (~ v) (~ vs)))) vars+lists))]) g!step (identifier$ "0step0") - g!blank (identifier$ "0_0") + g!blank (identifier$ "0,0") list-vars (map product.right vars+lists) code (` (: (~ zip-type) (function ((~ g!step) (~+ list-vars)) @@ -484,7 +484,7 @@ pattern (` [(~+ (map (function (_ [v vs]) (` (#.Cons (~ v) (~ vs)))) vars+lists))]) g!step (identifier$ "0step0") - g!blank (identifier$ "0_0") + g!blank (identifier$ "0,0") list-vars (map product.right vars+lists) code (` (: (~ zip-type) (function ((~ g!step) (~ g!func) (~+ list-vars)) diff --git a/stdlib/source/lux/data/number.lux b/stdlib/source/lux/data/number.lux index 9e658bd52..e673fc54f 100644 --- a/stdlib/source/lux/data/number.lux +++ b/stdlib/source/lux/data/number.lux @@ -18,8 +18,8 @@ "Given syntax for a " encoding " number, generates a Nat, an Int, a Rev or a Frac.") - underscore "Allows for the presence of underscore in the numbers." - description [cursor (#.Text ($_ "lux text concat" encoding " " underscore))]] + commas "Allows for the presence of commas among the digits." + description [cursor (#.Text ($_ "lux text concat" encoding " " commas))]] (#error.Success [state (list (` (doc (~ description) (~ example-1) (~ example-2))))])) @@ -27,27 +27,27 @@ _ (#error.Failure "Wrong syntax for 'encoding-doc'."))) -(def: (underscore-prefixed? number) +(def: (comma-prefixed? number) (-> Text Bit) - (case ("lux text index" number "_" 0) + (case ("lux text index" number "," 0) (#.Some 0) #1 _ #0)) -(def: clean-underscores +(def: clean-commas (-> Text Text) - (text.replace-all "_" "")) + (text.replace-all "," "")) (do-template [<macro> <nat> <int> <rev> <frac> <error> <doc>] [(macro: #export (<macro> tokens state) {#.doc <doc>} (case tokens (#.Cons [meta (#.Text repr')] #.Nil) - (if (underscore-prefixed? repr') + (if (comma-prefixed? repr') (#error.Failure <error>) - (let [repr (clean-underscores repr')] + (let [repr (clean-commas repr')] (case (:: <nat> decode repr) (#error.Success value) (#error.Success [state (list [meta (#.Nat value)])]) @@ -72,11 +72,11 @@ [bin /nat.binary /int.binary /rev.binary /frac.binary "Invalid binary syntax." - (encoding-doc "binary" (bin "+11001001") (bin "+11_00_10_01"))] + (encoding-doc "binary" (bin "+11001001") (bin "+11,00,10,01"))] [oct /nat.octal /int.octal /rev.octal /frac.octal "Invalid octal syntax." - (encoding-doc "octal" (oct "+615243") (oct "+615_243"))] + (encoding-doc "octal" (oct "+615243") (oct "+615,243"))] [hex /nat.hex /int.hex /rev.hex /frac.hex "Invalid hexadecimal syntax." - (encoding-doc "hexadecimal" (hex "deadBEEF") (hex "dead_BEEF"))] + (encoding-doc "hexadecimal" (hex "deadBEEF") (hex "dead,BEEF"))] ) diff --git a/stdlib/source/lux/data/number/int.lux b/stdlib/source/lux/data/number/int.lux index 1047b68f9..6e534caea 100644 --- a/stdlib/source/lux/data/number/int.lux +++ b/stdlib/source/lux/data/number/int.lux @@ -33,8 +33,8 @@ (structure: #export interval (Interval Int) (def: &enum ..enum) - (def: top +9_223_372_036_854_775_807) - (def: bottom -9_223_372_036_854_775_808)) + (def: top +9,223,372,036,854,775,807) + (def: bottom -9,223,372,036,854,775,808)) (structure: #export number (Number Int) (def: + i/+) diff --git a/stdlib/source/lux/data/number/nat.lux b/stdlib/source/lux/data/number/nat.lux index 9e249b207..bd3c4d9b5 100644 --- a/stdlib/source/lux/data/number/nat.lux +++ b/stdlib/source/lux/data/number/nat.lux @@ -46,8 +46,7 @@ (def: (signum x) (case x 0 0 - _ 1)) - ) + _ 1))) (do-template [<name> <compose> <identity>] [(structure: #export <name> (Monoid Nat) diff --git a/stdlib/source/lux/time/duration.lux b/stdlib/source/lux/time/duration.lux index e15004e14..8054e9074 100644 --- a/stdlib/source/lux/time/duration.lux +++ b/stdlib/source/lux/time/duration.lux @@ -105,7 +105,7 @@ (do-template [<name> <scale> <base>] [(def: #export <name> (scale-up <scale> <base>))] - [second 1_000 milli-second] + [second 1,000 milli-second] [minute 60 second] [hour 60 minute] [day 24 hour] diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux index 1ac559fc2..7d9906733 100644 --- a/stdlib/source/lux/time/instant.lux +++ b/stdlib/source/lux/time/instant.lux @@ -155,7 +155,7 @@ (cond (i/= +0 millis) "" (i/< +10 millis) ($_ text/compose ".00" (int/encode millis)) (i/< +100 millis) ($_ text/compose ".0" (int/encode millis)) - ## (i/< +1_000 millis) + ## (i/< +1,000 millis) ($_ text/compose "." (int/encode millis)))) (def: seconds-per-day Int (duration.query duration.second duration.day)) diff --git a/stdlib/source/lux/tool/compiler/default/syntax.lux b/stdlib/source/lux/tool/compiler/default/syntax.lux index 528fa6854..4743d26ce 100644 --- a/stdlib/source/lux/tool/compiler/default/syntax.lux +++ b/stdlib/source/lux/tool/compiler/default/syntax.lux @@ -105,7 +105,7 @@ (def: #export sigil "#") -(def: #export digit-separator "_") +(def: #export digit-separator ",") (def: #export positive-sign "+") (def: #export negative-sign "-") diff --git a/stdlib/source/lux/tool/compiler/phase/generation/scheme.lux b/stdlib/source/lux/tool/compiler/phase/generation/scheme.lux index 5e1947d20..df0db4c79 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/scheme.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/scheme.lux @@ -11,8 +11,9 @@ ["." case] ["." loop] ["." /// - ["." synthesis] - ["." extension]]]) + ["." extension] + [// + ["." synthesis]]]]) (def: #export (generate synthesis) Phase diff --git a/stdlib/source/lux/tool/compiler/phase/generation/scheme/case.jvm.lux b/stdlib/source/lux/tool/compiler/phase/generation/scheme/case.jvm.lux index d0f047c9f..aa04dc975 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/scheme/case.jvm.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/scheme/case.jvm.lux @@ -18,9 +18,9 @@ [// ["common-." reference] ["//." // ("#/." monad) - ["." synthesis (#+ Synthesis Path)] [// - [reference (#+ Register)]]]]]) + [reference (#+ Register)] + ["." synthesis (#+ Synthesis Path)]]]]]) (def: #export register (common-reference.local _.var)) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/scheme/extension/common.jvm.lux b/stdlib/source/lux/tool/compiler/phase/generation/scheme/extension/common.jvm.lux index d430aba24..602eb923b 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/scheme/extension/common.jvm.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/scheme/extension/common.jvm.lux @@ -20,9 +20,10 @@ [/// ["." runtime (#+ Operation Phase Handler Bundle)] ["//." /// - ["." synthesis (#+ Synthesis)] ["." extension - ["." bundle]]]]) + ["." bundle]] + [// + ["." synthesis (#+ Synthesis)]]]]) (syntax: (Vector {size s.nat} elemT) (wrap (list (` [(~+ (list.repeat size elemT))])))) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/scheme/function.jvm.lux b/stdlib/source/lux/tool/compiler/phase/generation/scheme/function.jvm.lux index e6069660b..891ef736c 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/scheme/function.jvm.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/scheme/function.jvm.lux @@ -18,10 +18,10 @@ ["/." // ["common-." reference] ["//." // ("#/." monad) - [analysis (#+ Variant Tuple Environment Arity Abstraction Application Analysis)] - [synthesis (#+ Synthesis)] [// [reference (#+ Register Variable)] + [analysis (#+ Variant Tuple Environment Arity Abstraction Application Analysis)] + [synthesis (#+ Synthesis)] ["." name]]]]]) (def: #export (apply generate [functionS argsS+]) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/scheme/loop.jvm.lux b/stdlib/source/lux/tool/compiler/phase/generation/scheme/loop.jvm.lux index 0e4adcf03..a177d6290 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/scheme/loop.jvm.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/scheme/loop.jvm.lux @@ -16,7 +16,8 @@ ["//." case] ["/." // ["//." // - [synthesis (#+ Scope Synthesis)]]]]) + [// + [synthesis (#+ Scope Synthesis)]]]]]) (def: @scope (_.var "scope")) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/scheme/reference.jvm.lux b/stdlib/source/lux/tool/compiler/phase/generation/scheme/reference.jvm.lux index b28cb1898..b531c38f7 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/scheme/reference.jvm.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/scheme/reference.jvm.lux @@ -2,10 +2,8 @@ [lux #* [host ["_" scheme (#+ Expression)]]] - [// - [// - [common - ["." reference]]]]) + [/// + ["." reference]]) (def: #export system (reference.system (: (-> Text Expression) _.global) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/scheme/runtime.jvm.lux b/stdlib/source/lux/tool/compiler/phase/generation/scheme/runtime.jvm.lux index 136e2ff2e..063e0c55f 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/scheme/runtime.jvm.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/scheme/runtime.jvm.lux @@ -17,10 +17,10 @@ ["_" scheme (#+ Expression Computation Var)]]] ["." /// ["//." // - [analysis (#+ Variant)] - ["." synthesis] [// - ["." name]]]]) + [analysis (#+ Variant)] + ["." name] + ["." synthesis]]]]) (do-template [<name> <base>] [(type: #export <name> @@ -295,7 +295,7 @@ (runtime: (io//current-time _) (|> (_.apply/* (_.global "current-second") (list)) - (_.*/2 (_.int +1_000)) + (_.*/2 (_.int +1,000)) _.exact/1)) (def: runtime//io diff --git a/stdlib/source/lux/tool/compiler/phase/generation/scheme/structure.jvm.lux b/stdlib/source/lux/tool/compiler/phase/generation/scheme/structure.jvm.lux index c586f0706..7419ad239 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/scheme/structure.jvm.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/scheme/structure.jvm.lux @@ -8,8 +8,9 @@ ["." runtime (#+ Operation Phase)] ["." primitive] ["." /// - [analysis (#+ Variant Tuple)] - ["." synthesis (#+ Synthesis)]]]) + [// + [analysis (#+ Variant Tuple)] + ["." synthesis (#+ Synthesis)]]]]) (def: #export (tuple generate elemsS+) (-> Phase (Tuple Synthesis) (Operation Expression)) diff --git a/stdlib/source/lux/type/unit.lux b/stdlib/source/lux/type/unit.lux index 69ff261b2..49ee2709b 100644 --- a/stdlib/source/lux/type/unit.lux +++ b/stdlib/source/lux/type/unit.lux @@ -150,13 +150,13 @@ (i// (.int denominator)) in))) -(scale: #export Kilo [+1 +1_000]) -(scale: #export Mega [+1 +1_000_000]) -(scale: #export Giga [+1 +1_000_000_000]) +(scale: #export Kilo [+1 +1,000]) +(scale: #export Mega [+1 +1,000,000]) +(scale: #export Giga [+1 +1,000,000,000]) -(scale: #export Milli [ +1_000 +1]) -(scale: #export Micro [ +1_000_000 +1]) -(scale: #export Nano [+1_000_000_000 +1]) +(scale: #export Milli [ +1,000 +1]) +(scale: #export Micro [ +1,000,000 +1]) +(scale: #export Nano [+1,000,000,000 +1]) (unit: #export Gram) (unit: #export Meter) diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index c2ca8b3ba..87bf92b1b 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -5,7 +5,6 @@ [case (#+)] [loop (#+)] [function (#+)] - [expression (#+)] [extension (#+) [common (#+)] [host (#+)]])] @@ -40,10 +39,10 @@ [tool [compiler [phase - [translation - [scheme + [generation + [scheme (#+) <host-modules>] - [js + [js (#+) <host-modules>]]]]] ## [control ## ["._" contract] @@ -85,7 +84,7 @@ ## ["._" default ## ["._" evaluation] ## [phase - ## ["._" translation + ## ["._" generation ## [scheme ## ["._scheme" function] ## ["._scheme" loop] @@ -397,11 +396,11 @@ (..conversion <gen> <forward> <backward> <=>))] ["Int -> Nat" - i/= .nat .int (r/map (i/% +1_000_000) r.int)] + i/= .nat .int (r/map (i/% +1,000,000) r.int)] ["Nat -> Int" - n/= .int .nat (r/map (n/% 1_000_000) r.nat)] + n/= .int .nat (r/map (n/% 1,000,000) r.nat)] ["Int -> Frac" - i/= int-to-frac frac-to-int (r/map (i/% +1_000_000) r.int)] + i/= int-to-frac frac-to-int (r/map (i/% +1,000,000) r.int)] ["Frac -> Int" f/= frac-to-int int-to-frac (r/map math.floor r.frac)] ["Rev -> Frac" diff --git a/stdlib/source/test/lux/data/collection/bits.lux b/stdlib/source/test/lux/data/collection/bits.lux index aeeac1429..e932aacef 100644 --- a/stdlib/source/test/lux/data/collection/bits.lux +++ b/stdlib/source/test/lux/data/collection/bits.lux @@ -22,14 +22,14 @@ (def: bits (r.Random /.Bits) (do r.monad - [size (size 1 1_000) + [size (size 1 1,000) idx (|> r.nat (:: @ map (n/% size)))] (wrap (|> /.empty (/.set idx))))) (context: "Bits." (<| (times 100) (do @ - [size (size 1 1_000) + [size (size 1 1,000) idx (|> r.nat (:: @ map (n/% size))) sample bits] ($_ seq diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index f54b51c3b..cdaeb5d31 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -49,7 +49,7 @@ ($_ r.or (:: @ wrap []) r.bit - (|> r.frac (:: @ map (f/* +1_000_000.0))) + (|> r.frac (:: @ map (f/* +1,000,000.0))) (r.unicode size) (r.row size gen-json) (r.dictionary text.hash size (r.unicode size) gen-json) diff --git a/stdlib/source/test/lux/macro/poly/equivalence.lux b/stdlib/source/test/lux/macro/poly/equivalence.lux index 3c6bfd234..a73d71112 100644 --- a/stdlib/source/test/lux/macro/poly/equivalence.lux +++ b/stdlib/source/test/lux/macro/poly/equivalence.lux @@ -49,7 +49,7 @@ (r.Random Record) (do r.monad [size (:: @ map (n/% 2) r.nat) - #let [gen-int (|> r.int (:: @ map (|>> int/abs (i/% +1_000_000))))]] + #let [gen-int (|> r.int (:: @ map (|>> int/abs (i/% +1,000,000))))]] ($_ r.and r.bit gen-int diff --git a/stdlib/source/test/lux/time/instant.lux b/stdlib/source/test/lux/time/instant.lux index c9d7aad55..a95eaf612 100644 --- a/stdlib/source/test/lux/time/instant.lux +++ b/stdlib/source/test/lux/time/instant.lux @@ -18,7 +18,7 @@ [// ["_." duration]]) -(def: boundary Int +99_999_999_999_999) +(def: boundary Int +99,999,999,999,999) (def: #export instant (r.Random @.Instant) diff --git a/stdlib/source/test/lux/world/file.lux b/stdlib/source/test/lux/world/file.lux index 361cf99ba..80d4a524b 100644 --- a/stdlib/source/test/lux/world/file.lux +++ b/stdlib/source/test/lux/world/file.lux @@ -25,7 +25,8 @@ ["_." binary]]) (def: truncate-millis - (|>> (i// +1_000) (i/* +1_000))) + (let [millis +1,000] + (|>> (i// millis) (i/* millis)))) (def: (creation-and-deletion number) (-> Nat Test) |