diff options
Diffstat (limited to 'lux-jvm/source/luxc/lang/translation/jvm')
10 files changed, 118 insertions, 118 deletions
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/case.lux b/lux-jvm/source/luxc/lang/translation/jvm/case.lux index a863f9113..d3f6a29c1 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/case.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/case.lux @@ -41,7 +41,7 @@ 0 function.identity 1 _.POP 2 _.POP2 - _ ## (n.> 2) + _ ... (n.> 2) (|>> _.POP2 (pop_altI (n.- 2 stack_depth))))) @@ -183,7 +183,7 @@ ([synthesis.side/left false] [synthesis.side/right true]) - ## Extra optimization + ... Extra optimization (^template [<path> <projection>] [(^ (<path> lefts)) (operation@in (|>> peekI diff --git a/lux-jvm/source/luxc/lang/translation/jvm/common.lux b/lux-jvm/source/luxc/lang/translation/jvm/common.lux index 65714f909..283081608 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/common.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/common.lux @@ -1,73 +1,73 @@ (.module: [library [lux #* - ## [abstract - ## [monad (#+ do)]] - ## [control - ## ["." try (#+ Try)] - ## ["ex" exception (#+ exception:)] - ## ["." io]] - ## [data - ## [binary (#+ Binary)] - ## ["." text ("#/." hash) - ## format] - ## [collection - ## ["." dictionary (#+ Dictionary)]]] - ## ["." macro] - ## [host (#+ import:)] - ## [tool - ## [compiler - ## [reference (#+ Register)] - ## ["." name] - ## ["." phase]]] + ... [abstract + ... [monad (#+ do)]] + ... [control + ... ["." try (#+ Try)] + ... ["ex" exception (#+ exception:)] + ... ["." io]] + ... [data + ... [binary (#+ Binary)] + ... ["." text ("#/." hash) + ... format] + ... [collection + ... ["." dictionary (#+ Dictionary)]]] + ... ["." macro] + ... [host (#+ import:)] + ... [tool + ... [compiler + ... [reference (#+ Register)] + ... ["." name] + ... ["." phase]]] ]] - ## [luxc - ## [lang - ## [host - ## ["." jvm - ## [type]]]]] + ... [luxc + ... [lang + ... [host + ... ["." jvm + ... [type]]]]] ) -## (def: .public (with-artifacts action) -## (All [a] (-> (Meta a) (Meta [Artifacts a]))) -## (function (_ state) -## (case (action (update@ #.host -## (|>> (:coerce Host) -## (set@ #artifacts (dictionary.new text.hash)) -## (:coerce Nothing)) -## state)) -## (#try.Success [state' output]) -## (#try.Success [(update@ #.host -## (|>> (:coerce Host) -## (set@ #artifacts (|> (get@ #.host state) (:coerce Host) (get@ #artifacts))) -## (:coerce Nothing)) -## state') -## [(|> state' (get@ #.host) (:coerce Host) (get@ #artifacts)) -## output]]) +... (def: .public (with-artifacts action) +... (All [a] (-> (Meta a) (Meta [Artifacts a]))) +... (function (_ state) +... (case (action (update@ #.host +... (|>> (:coerce Host) +... (set@ #artifacts (dictionary.new text.hash)) +... (:coerce Nothing)) +... state)) +... (#try.Success [state' output]) +... (#try.Success [(update@ #.host +... (|>> (:coerce Host) +... (set@ #artifacts (|> (get@ #.host state) (:coerce Host) (get@ #artifacts))) +... (:coerce Nothing)) +... state') +... [(|> state' (get@ #.host) (:coerce Host) (get@ #artifacts)) +... output]]) -## (#try.Failure error) -## (#try.Failure error)))) +... (#try.Failure error) +... (#try.Failure error)))) -## (def: .public (load-definition state) -## (-> Lux (-> Name Binary (Try Any))) -## (function (_ (^@ def-name [def-module def-name]) def-bytecode) -## (let [normal-name (format (name.normalize def-name) (%n (text/hash def-name))) -## class-name (format (text.replace-all "/" "." def-module) "." normal-name)] -## (<| (macro.run state) -## (do macro.monad -## [_ (..store-class class-name def-bytecode) -## class (..load-class class-name)] -## (case (do try.monad -## [field (Class::getField [..value-field] class)] -## (Field::get [#.None] field)) -## (#try.Success (#.Some def-value)) -## (wrap def-value) +... (def: .public (load-definition state) +... (-> Lux (-> Name Binary (Try Any))) +... (function (_ (^@ def-name [def-module def-name]) def-bytecode) +... (let [normal-name (format (name.normalize def-name) (%n (text/hash def-name))) +... class-name (format (text.replace-all "/" "." def-module) "." normal-name)] +... (<| (macro.run state) +... (do macro.monad +... [_ (..store-class class-name def-bytecode) +... class (..load-class class-name)] +... (case (do try.monad +... [field (Class::getField [..value-field] class)] +... (Field::get [#.None] field)) +... (#try.Success (#.Some def-value)) +... (wrap def-value) -## (#try.Success #.None) -## (phase.throw invalid-definition-value (%name def-name)) +... (#try.Success #.None) +... (phase.throw invalid-definition-value (%name def-name)) -## (#try.Failure error) -## (phase.throw cannot-load-definition -## (format "Definition: " (%name def-name) "\n" -## "Error:\n" -## error)))))))) +... (#try.Failure error) +... (phase.throw cannot-load-definition +... (format "Definition: " (%name def-name) "\n" +... "Error:\n" +... error)))))))) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux index 8c6d96283..14d31d4e2 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux @@ -84,7 +84,7 @@ (def: unitI Inst (_.string synthesis.unit)) -## TODO: Get rid of this ASAP +... TODO: Get rid of this ASAP (def: lux::syntax_char_case! (..custom [($_ <>.and <s>.any diff --git a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux index 069f23fae..2d94e822c 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux @@ -590,7 +590,7 @@ [box.float type.float] [box.double type.double] [box.char type.char])) - ## else + ... else (in valueI)))) _ @@ -1024,7 +1024,7 @@ [1 _.FLOAD type.float] [2 _.LLOAD type.long])) - ## (\ type.equivalence = type.double argumentT) + ... (\ type.equivalence = type.double argumentT) (wrap_primitive 2 _.DLOAD type.double)))))) (def: .public (prepare_arguments offset types) @@ -1070,7 +1070,7 @@ [_.FRETURN type.float] [_.LRETURN type.long])) - ## (\ type.equivalence = type.double returnT) + ... (\ type.equivalence = type.double returnT) (unwrap_primitive _.DRETURN type.double))))))) (def: class::anonymous @@ -1091,15 +1091,15 @@ anonymous_class_name (///.class_name context) class (type.class anonymous_class_name (list)) total_environment (|> overriden_methods - ## Get all the environments. + ... Get all the environments. (list\map product.left) - ## Combine them. + ... Combine them. list\join - ## Remove duplicates. + ... Remove duplicates. (set.of_list synthesis.hash) set.list) global_mapping (|> total_environment - ## Give them names as "foreign" variables. + ... Give them names as "foreign" variables. list.enumeration (list\map (function (_ [id capture]) [capture (#variable.Foreign id)])) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/function.lux b/lux-jvm/source/luxc/lang/translation/jvm/function.lux index ac2adaaaa..b39157480 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/function.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/function.lux @@ -233,7 +233,7 @@ (applysI (inc args_to_completion) args_left) _.ARETURN)) - ## (i.< over_extent (.int stage)) + ... (i.< over_extent (.int stage)) (let [env_size (list.size env) load_capturedI (|> (case env_size 0 (list) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/loop.lux b/lux-jvm/source/luxc/lang/translation/jvm/loop.lux index bd1e29d0f..85187815d 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/loop.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/loop.lux @@ -44,14 +44,14 @@ list.enumeration (list@map (function (_ [register argument]) [(n.+ start register) argument])))] - ## It may look weird that first I compile the values separately, - ## and then I compile the stores/allocations. - ## It must be done that way in order to avoid a potential bug. - ## Let's say that you'll recur with 2 expressions: X and Y. - ## If Y depends on the value of X, and you don't compile values - ## and stores separately, then by the time Y is evaluated, it - ## will refer to the new value of X, instead of the old value, and - ## shouldn't be the case. + ... It may look weird that first I compile the values separately, + ... and then I compile the stores/allocations. + ... It must be done that way in order to avoid a potential bug. + ... Let's say that you'll recur with 2 expressions: X and Y. + ... If Y depends on the value of X, and you don't compile values + ... and stores separately, then by the time Y is evaluated, it + ... will refer to the new value of X, instead of the old value, and + ... shouldn't be the case. valuesI+ (monad.map @ (function (_ [register argS]) (: (Operation Inst) (if (invariant? register argS) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux b/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux index 313c12f9b..359406e7e 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux @@ -46,8 +46,8 @@ [<int> (operation@in (|>> <instruction> _.I2L (_.wrap type.long)))]) ([-1 _.ICONST_M1] - ## [+0 _.ICONST_0] - ## [+1 _.ICONST_1] + ... [+0 _.ICONST_0] + ... [+1 _.ICONST_1] [+2 _.ICONST_2] [+3 _.ICONST_3] [+4 _.ICONST_4] @@ -62,7 +62,7 @@ (i.<= (java/lang/Short::MAX_VALUE) value)) (|>> (_.SIPUSH value) _.I2L) - ## else + ... else (|> value .int _.long))] (operation@in (|>> constantI (_.wrap type.long)))))) @@ -91,8 +91,8 @@ [<int> (operation@in (|>> <instruction> _.I2D (_.wrap type.double)))]) ([-1.0 _.ICONST_M1] - ## [+0.0 _.ICONST_0] - ## [+1.0 _.ICONST_1] + ... [+0.0 _.ICONST_0] + ... [+1.0 _.ICONST_1] [+2.0 _.ICONST_2] [+3.0 _.ICONST_3] [+4.0 _.ICONST_4] diff --git a/lux-jvm/source/luxc/lang/translation/jvm/reference.lux b/lux-jvm/source/luxc/lang/translation/jvm/reference.lux index f23fb56a3..a62dc5eea 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/reference.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/reference.lux @@ -1,6 +1,6 @@ (.module: [library - [lux #* + [lux (#- local) [abstract [monad (#+ do)]] [data diff --git a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux index 13c5fe074..4d97535d1 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux @@ -205,11 +205,11 @@ ::last? (variant_partI 1) ::value (variant_partI 2) - super_nested_tag (|>> _.SWAP ## variant::tag, tag + super_nested_tag (|>> _.SWAP ... variant::tag, tag _.ISUB) - super_nested (|>> super_nested_tag ## super_tag - $variant ::last? ## super_tag, super_last - $variant ::value ## super_tag, super_last, super_value + super_nested (|>> super_nested_tag ... super_tag + $variant ::last? ... super_tag, super_last + $variant ::value ... super_tag, super_last, super_value ..variantI) update_$tag _.ISUB @@ -223,28 +223,28 @@ (_.GOTO @loop)))) not_found _.NULL]) - (|>> $tag ## tag + (|>> $tag ... tag (_.label @loop) - $variant ::tag ## tag, variant::tag - _.DUP2 (_.IF_ICMPEQ @tags_match!) ## tag, variant::tag - _.DUP2 (_.IF_ICMPGT @maybe_nested) ## tag, variant::tag - $last? (_.IFNULL @mismatch!) ## tag, variant::tag - super_nested ## super_variant + $variant ::tag ... tag, variant::tag + _.DUP2 (_.IF_ICMPEQ @tags_match!) ... tag, variant::tag + _.DUP2 (_.IF_ICMPGT @maybe_nested) ... tag, variant::tag + $last? (_.IFNULL @mismatch!) ... tag, variant::tag + super_nested ... super_variant _.ARETURN - (_.label @tags_match!) ## tag, variant::tag - $last? ## tag, variant::tag, last? - $variant ::last? ## tag, variant::tag, last?, variant::last? - (_.IF_ACMPEQ @perfect_match!) ## tag, variant::tag - (_.label @maybe_nested) ## tag, variant::tag - $variant ::last? ## tag, variant::tag, variant::last? - (_.IFNULL @mismatch!) ## tag, variant::tag + (_.label @tags_match!) ... tag, variant::tag + $last? ... tag, variant::tag, last? + $variant ::last? ... tag, variant::tag, last?, variant::last? + (_.IF_ACMPEQ @perfect_match!) ... tag, variant::tag + (_.label @maybe_nested) ... tag, variant::tag + $variant ::last? ... tag, variant::tag, variant::last? + (_.IFNULL @mismatch!) ... tag, variant::tag (iterate! @loop) - (_.label @perfect_match!) ## tag, variant::tag - ## _.POP2 + (_.label @perfect_match!) ... tag, variant::tag + ... _.POP2 $variant ::value _.ARETURN - (_.label @mismatch!) ## tag, variant::tag - ## _.POP2 + (_.label @mismatch!) ... tag, variant::tag + ... _.POP2 not_found _.ARETURN))) ($d.method #$.Public $.staticM "tuple_left" (type.method [(list) (list //.$Tuple $Index) $Value (list)]) @@ -256,7 +256,7 @@ left_accessI _.ARETURN (_.label @recursive) - ## Recursive + ... Recursive (recurI @loop)))) ($d.method #$.Public $.staticM "tuple_right" (type.method [(list) (list //.$Tuple $Index) $Value (list)]) (<| _.with_label (function (_ @loop)) @@ -279,12 +279,12 @@ (|>> (_.label @loop) last_rightI right_indexI _.DUP2 (_.IF_ICMPNE @not_tail) - ## _.POP + ... _.POP right_accessI _.ARETURN (_.label @not_tail) (_.IF_ICMPGT @slice) - ## Must recurse + ... Must recurse (recurI @loop) (_.label @slice) sub_rightI @@ -322,11 +322,11 @@ _.ARETURN (_.label @to) (_.label @handler) - string_writerI ## TW - _.DUP2 ## TWTW - print_writerI ## TWTP - (_.INVOKEVIRTUAL $Throwable "printStackTrace" (type.method [(list) (list (type.class "java.io.PrintWriter" (list))) type.void (list)])) ## TW - (_.INVOKEVIRTUAL StringWriter "toString" (type.method [(list) (list) $Text (list)])) ## TS + string_writerI ... TW + _.DUP2 ... TWTW + print_writerI ... TWTP + (_.INVOKEVIRTUAL $Throwable "printStackTrace" (type.method [(list) (list (type.class "java.io.PrintWriter" (list))) type.void (list)])) ... TW + (_.INVOKEVIRTUAL StringWriter "toString" (type.method [(list) (list) $Text (list)])) ... TS _.SWAP _.POP leftI _.ARETURN))) ))) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/structure.lux b/lux-jvm/source/luxc/lang/translation/jvm/structure.lux index 00a3539ca..ce9c56aed 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/structure.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/structure.lux @@ -92,7 +92,7 @@ (i.<= (java/lang/Short::MAX_VALUE) tag)) (_.SIPUSH tag) - ## else + ... else (_.int tag))))) (def: .public leftI _.NULL) |