diff options
author | Eduardo Julian | 2020-10-25 05:10:08 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-10-25 05:10:08 -0400 |
commit | 72b4eecdc514387ab3b1c105cfd49436c9eb1e8d (patch) | |
tree | 20d8e52d5769b00be003dea58754b5bea79bb9e3 /stdlib/source/lux/target/jvm | |
parent | e153b011bb94ba95474505c307873616bb493b6d (diff) |
Some improvements to the Lux syntax parser.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/target/jvm/bytecode.lux | 48 | ||||
-rw-r--r-- | stdlib/source/lux/target/jvm/bytecode/instruction.lux | 20 | ||||
-rw-r--r-- | stdlib/source/lux/target/jvm/class.lux | 6 | ||||
-rw-r--r-- | stdlib/source/lux/target/jvm/constant/pool.lux | 4 | ||||
-rw-r--r-- | stdlib/source/lux/target/jvm/loader.lux | 4 | ||||
-rw-r--r-- | stdlib/source/lux/target/jvm/method.lux | 8 | ||||
-rw-r--r-- | stdlib/source/lux/target/jvm/reflection.lux | 8 | ||||
-rw-r--r-- | stdlib/source/lux/target/jvm/type/lux.lux | 4 |
8 files changed, 51 insertions, 51 deletions
diff --git a/stdlib/source/lux/target/jvm/bytecode.lux b/stdlib/source/lux/target/jvm/bytecode.lux index 8b59f77ba..2b3d600f7 100644 --- a/stdlib/source/lux/target/jvm/bytecode.lux +++ b/stdlib/source/lux/target/jvm/bytecode.lux @@ -183,11 +183,11 @@ (def: (bytecode consumption production registry [estimator bytecode] input) (All [a] (-> U2 U2 Registry [Estimator (-> [a] Instruction)] [a] (Bytecode Any))) (function (_ [pool environment tracker]) - (do {@ try.monad} + (do {! try.monad} [environment' (|> environment (/environment.consumes consumption) - (monad.bind @ (/environment.produces production)) - (monad.bind @ (/environment.has registry))) + (monad.bind ! (/environment.produces production)) + (monad.bind ! (/environment.has registry))) program-counter' (step estimator (get@ #program-counter tracker))] (wrap [[pool environment' @@ -687,8 +687,8 @@ (def: (jump @from @to) (-> Address Address (Try Any-Jump)) - (do {@ try.monad} - [jump (:: @ map //signed.value + (do {! try.monad} + [jump (:: ! map //signed.value (/address.jump @from @to))] (let [big? (n.> (//unsigned.value //unsigned.maximum/2) (.nat (i.* (if (i.>= +0 jump) @@ -696,8 +696,8 @@ -1) jump)))] (if big? - (:: @ map (|>> #.Left) (//signed.s4 jump)) - (:: @ map (|>> #.Right) (//signed.s2 jump)))))) + (:: ! map (|>> #.Left) (//signed.s4 jump)) + (:: ! map (|>> #.Right) (//signed.s2 jump)))))) (exception: #export (unset-label {label Label}) (exception.report @@ -849,18 +849,18 @@ (let [get (: (-> Label (Maybe [Stack (Maybe Address)])) (function (_ label) (dictionary.get label resolver)))] - (case (do {@ maybe.monad} - [@default (|> default get (monad.bind @ product.right)) - @at-minimum (|> at-minimum get (monad.bind @ product.right)) + (case (do {! maybe.monad} + [@default (|> default get (monad.bind ! product.right)) + @at-minimum (|> at-minimum get (monad.bind ! product.right)) @afterwards (|> afterwards - (monad.map @ get) - (monad.bind @ (monad.map @ product.right)))] + (monad.map ! get) + (monad.bind ! (monad.map ! product.right)))] (wrap [@default @at-minimum @afterwards])) (#.Some [@default @at-minimum @afterwards]) - (do {@ try.monad} - [>default (:: @ map ..big-jump (..jump @from @default)) - >at-minimum (:: @ map ..big-jump (..jump @from @at-minimum)) - >afterwards (monad.map @ (|>> (..jump @from) (:: @ map ..big-jump)) + (do {! try.monad} + [>default (:: ! map ..big-jump (..jump @from @default)) + >at-minimum (:: ! map ..big-jump (..jump @from @at-minimum)) + >afterwards (monad.map ! (|>> (..jump @from) (:: ! map ..big-jump)) @afterwards)] (wrap [..no-exceptions (bytecode minimum >default [>at-minimum >afterwards])])) @@ -892,18 +892,18 @@ (let [get (: (-> Label (Maybe [Stack (Maybe Address)])) (function (_ label) (dictionary.get label resolver)))] - (case (do {@ maybe.monad} - [@default (|> default get (monad.bind @ product.right)) + (case (do {! maybe.monad} + [@default (|> default get (monad.bind ! product.right)) @cases (|> cases - (monad.map @ (|>> product.right get)) - (monad.bind @ (monad.map @ product.right)))] + (monad.map ! (|>> product.right get)) + (monad.bind ! (monad.map ! product.right)))] (wrap [@default @cases])) (#.Some [@default @cases]) - (do {@ try.monad} - [>default (:: @ map ..big-jump (..jump @from @default)) + (do {! try.monad} + [>default (:: ! map ..big-jump (..jump @from @default)) >cases (|> @cases - (monad.map @ (|>> (..jump @from) (:: @ map ..big-jump))) - (:: @ map (|>> (list.zip/2 (list@map product.left cases)))))] + (monad.map ! (|>> (..jump @from) (:: ! map ..big-jump))) + (:: ! map (|>> (list.zip/2 (list@map product.left cases)))))] (wrap [..no-exceptions (bytecode >default >cases)])) #.None diff --git a/stdlib/source/lux/target/jvm/bytecode/instruction.lux b/stdlib/source/lux/target/jvm/bytecode/instruction.lux index fc7e74987..eac3f8651 100644 --- a/stdlib/source/lux/target/jvm/bytecode/instruction.lux +++ b/stdlib/source/lux/target/jvm/bytecode/instruction.lux @@ -601,21 +601,21 @@ (function (_ [size mutation]) (let [padding (switch-padding size) tableswitch-size (try.assume - (do {@ try.monad} + (do {! try.monad} [size (///unsigned.u2 size)] - (:: @ map (|>> estimator ///unsigned.value) + (:: ! map (|>> estimator ///unsigned.value) (//address.move size //address.start)))) tableswitch-mutation (: Mutation (function (_ [offset binary]) [(n.+ tableswitch-size offset) (try.assume - (do {@ try.monad} + (do {! try.monad} [amount-of-afterwards (|> amount-of-afterwards .int ///signed.s4) maximum (///signed.+/4 minimum amount-of-afterwards) _ (binary.write/8 offset (hex "AA") binary) #let [offset (n.+ (///unsigned.value ..opcode-size) offset)] _ (case padding - 3 (do @ + 3 (do ! [_ (binary.write/8 offset 0 binary)] (binary.write/16 (inc offset) 0 binary)) 2 (binary.write/16 offset 0 binary) @@ -635,7 +635,7 @@ (wrap binary) (#.Cons head tail) - (do @ + (do ! [_ (binary.write/32 offset (///signed.value head) binary)] (recur (n.+ (///unsigned.value ..big-jump-size) offset) tail))))))]))] @@ -665,19 +665,19 @@ (function (_ [size mutation]) (let [padding (switch-padding size) lookupswitch-size (try.assume - (do {@ try.monad} + (do {! try.monad} [size (///unsigned.u2 size)] - (:: @ map (|>> estimator ///unsigned.value) + (:: ! map (|>> estimator ///unsigned.value) (//address.move size //address.start)))) lookupswitch-mutation (: Mutation (function (_ [offset binary]) [(n.+ lookupswitch-size offset) (try.assume - (do {@ try.monad} + (do {! try.monad} [_ (binary.write/8 offset (hex "AB") binary) #let [offset (n.+ (///unsigned.value ..opcode-size) offset)] _ (case padding - 3 (do @ + 3 (do ! [_ (binary.write/8 offset 0 binary)] (binary.write/16 (inc offset) 0 binary)) 2 (binary.write/16 offset 0 binary) @@ -694,7 +694,7 @@ (wrap binary) (#.Cons [value jump] tail) - (do @ + (do ! [_ (binary.write/32 offset (///signed.value value) binary) _ (binary.write/32 (n.+ (///unsigned.value ..integer-size) offset) (///signed.value jump) binary)] (recur (n.+ case-size offset) diff --git a/stdlib/source/lux/target/jvm/class.lux b/stdlib/source/lux/target/jvm/class.lux index db5ab9b4c..5a975cf8a 100644 --- a/stdlib/source/lux/target/jvm/class.lux +++ b/stdlib/source/lux/target/jvm/class.lux @@ -72,12 +72,12 @@ (def: (install-classes this super interfaces) (-> Internal Internal (List Internal) (Resource [(Index //constant.Class) (Index //constant.Class) (Row (Index //constant.Class))])) - (do {@ //constant/pool.monad} + (do {! //constant/pool.monad} [@this (//constant/pool.class this) @super (//constant/pool.class super) @interfaces (: (Resource (Row (Index //constant.Class))) - (monad.fold @ (function (_ interface @interfaces) - (do @ + (monad.fold ! (function (_ interface @interfaces) + (do ! [@interface (//constant/pool.class interface)] (wrap (row.add @interface @interfaces)))) row.empty diff --git a/stdlib/source/lux/target/jvm/constant/pool.lux b/stdlib/source/lux/target/jvm/constant/pool.lux index 8028787d7..2d2b1b940 100644 --- a/stdlib/source/lux/target/jvm/constant/pool.lux +++ b/stdlib/source/lux/target/jvm/constant/pool.lux @@ -66,13 +66,13 @@ (#try.Failure _) (let [new (<tag> <value>')] - (do {@ try.monad} + (do {! try.monad} [@new (//unsigned.u2 (//.size new)) next (: (Try Index) (|> current //index.value (//unsigned.+/2 @new) - (:: @ map //index.index)))] + (:: ! map //index.index)))] (wrap [[next (row.add [current new] pool)] current]))))))))) diff --git a/stdlib/source/lux/target/jvm/loader.lux b/stdlib/source/lux/target/jvm/loader.lux index e17496ffb..14c19bb86 100644 --- a/stdlib/source/lux/target/jvm/loader.lux +++ b/stdlib/source/lux/target/jvm/loader.lux @@ -122,11 +122,11 @@ (def: #export (store name bytecode library) (-> Text Binary Library (IO (Try Any))) - (do {@ io.monad} + (do {! io.monad} [library' (atom.read library)] (if (dictionary.contains? name library') (wrap (exception.throw ..already-stored name)) - (do @ + (do ! [_ (atom.update (dictionary.put name bytecode) library)] (wrap (#try.Success [])))))) diff --git a/stdlib/source/lux/target/jvm/method.lux b/stdlib/source/lux/target/jvm/method.lux index 9f902f55e..daae88521 100644 --- a/stdlib/source/lux/target/jvm/method.lux +++ b/stdlib/source/lux/target/jvm/method.lux @@ -53,15 +53,15 @@ (def: #export (method modifier name type attributes code) (-> (Modifier Method) UTF8 (Type //type/category.Method) (List (Resource Attribute)) (Maybe (Bytecode Any)) (Resource Method)) - (do {@ //constant/pool.monad} + (do {! //constant/pool.monad} [@name (//constant/pool.utf8 name) @descriptor (//constant/pool.descriptor (//type.descriptor type)) attributes (|> attributes - (monad.seq @) - (:: @ map row.from-list)) + (monad.seq !) + (:: ! map row.from-list)) attributes (case code (#.Some code) - (do @ + (do ! [environment (case (if (//modifier.has? static modifier) (//bytecode/environment.static type) (//bytecode/environment.virtual type)) diff --git a/stdlib/source/lux/target/jvm/reflection.lux b/stdlib/source/lux/target/jvm/reflection.lux index 7bc23199d..9cbcd4535 100644 --- a/stdlib/source/lux/target/jvm/reflection.lux +++ b/stdlib/source/lux/target/jvm/reflection.lux @@ -151,11 +151,11 @@ (let [raw (java/lang/reflect/ParameterizedType::getRawType reflection)] (case (host.check java/lang/Class raw) (#.Some raw) - (do {@ try.monad} + (do {! try.monad} [paramsT (|> reflection java/lang/reflect/ParameterizedType::getActualTypeArguments array.to-list - (monad.map @ parameter))] + (monad.map ! parameter))] (wrap (/.class (|> raw (:coerce (java/lang/Class java/lang/Object)) java/lang/Class::getName) @@ -341,14 +341,14 @@ (template [<name> <exception> <then?> <else?>] [(def: #export (<name> field class) (-> Text (java/lang/Class java/lang/Object) (Try [Bit (/.Type Value)])) - (do {@ try.monad} + (do {! try.monad} [fieldJ (..field field class) #let [modifiers (java/lang/reflect/Field::getModifiers fieldJ)]] (case (java/lang/reflect/Modifier::isStatic modifiers) <then?> (|> fieldJ java/lang/reflect/Field::getGenericType ..type - (:: @ map (|>> [(java/lang/reflect/Modifier::isFinal modifiers)]))) + (:: ! map (|>> [(java/lang/reflect/Modifier::isFinal modifiers)]))) <else?> (exception.throw <exception> [field class]))))] [static-field ..not-a-static-field #1 #0] diff --git a/stdlib/source/lux/target/jvm/type/lux.lux b/stdlib/source/lux/target/jvm/type/lux.lux index 0ac0d013c..83a61de01 100644 --- a/stdlib/source/lux/target/jvm/type/lux.lux +++ b/stdlib/source/lux/target/jvm/type/lux.lux @@ -103,8 +103,8 @@ (<>.after (<t>.this //signature.parameters-start)) (<>.before (<t>.this //signature.parameters-end)) (<>.default (list)))] - (wrap (do {@ check.monad} - [parameters (monad.seq @ parameters)] + (wrap (do {! check.monad} + [parameters (monad.seq ! parameters)] (wrap (#.Primitive name parameters))))) (<>.after (<t>.this //descriptor.class-prefix)) (<>.before (<t>.this //descriptor.class-suffix)))) |