aboutsummaryrefslogtreecommitdiff
path: root/lux-jvm
diff options
context:
space:
mode:
authorEduardo Julian2021-08-23 02:30:53 -0400
committerEduardo Julian2021-08-23 02:30:53 -0400
commitec1f31b5a1492d5e0ab260397291d4449483bbd9 (patch)
treec730b4ca89af366779b0ad0f46fae705b5c2bcbc /lux-jvm
parent1ea83ecadccc5adee1bdb35bd11527c3982c015e (diff)
The Python compiler can now be compiled by the new JVM compiler.
Diffstat (limited to 'lux-jvm')
-rw-r--r--lux-jvm/source/luxc/lang/directive/jvm.lux38
-rw-r--r--lux-jvm/source/luxc/lang/synthesis/variable.lux22
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/case.lux52
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux10
-rw-r--r--lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux78
-rw-r--r--lux-jvm/test/test/luxc/lang/synthesis/loop.lux2
6 files changed, 101 insertions, 101 deletions
diff --git a/lux-jvm/source/luxc/lang/directive/jvm.lux b/lux-jvm/source/luxc/lang/directive/jvm.lux
index a7314b0dc..2c6577ae1 100644
--- a/lux-jvm/source/luxc/lang/directive/jvm.lux
+++ b/lux-jvm/source/luxc/lang/directive/jvm.lux
@@ -18,9 +18,9 @@
["%" format (#+ format)]]
[collection
[array (#+ Array)]
- ["." list ("#\." fold functor monoid)]
+ ["." list ("#\." mix functor monoid)]
["." dictionary (#+ Dictionary)]
- ["." row (#+ Row) ("#\." functor fold)]]]
+ ["." row (#+ Row) ("#\." functor mix)]]]
[math
[number
["." nat]]]
@@ -442,18 +442,18 @@
(#/.TABLESWITCH min max default labels)
(let [[mapping default] (..relabel [mapping default])
- [mapping labels] (list\fold (function (_ input [mapping output])
- (let [[mapping input] (..relabel [mapping input])]
- [mapping (list& input output)]))
- [mapping (list)] labels)]
+ [mapping labels] (list\mix (function (_ input [mapping output])
+ (let [[mapping input] (..relabel [mapping input])]
+ [mapping (list& input output)]))
+ [mapping (list)] labels)]
[mapping (#/.TABLESWITCH min max default (list.reversed labels))])
(#/.LOOKUPSWITCH default keys+labels)
(let [[mapping default] (..relabel [mapping default])
- [mapping keys+labels] (list\fold (function (_ [expected input] [mapping output])
- (let [[mapping input] (..relabel [mapping input])]
- [mapping (list& [expected input] output)]))
- [mapping (list)] keys+labels)]
+ [mapping keys+labels] (list\mix (function (_ [expected input] [mapping output])
+ (let [[mapping input] (..relabel [mapping input])]
+ [mapping (list& [expected input] output)]))
+ [mapping (list)] keys+labels)]
[mapping (#/.LOOKUPSWITCH default (list.reversed keys+labels))])
))
@@ -515,11 +515,11 @@
(def: (relabel_bytecode [mapping bytecode])
(Re_labeler (/.Bytecode Inst))
- (row\fold (function (_ input [mapping output])
- (let [[mapping input'] (..relabel_instruction [mapping input])]
- [mapping (row.suffix input' output)]))
- [mapping (row.row)]
- bytecode))
+ (row\mix (function (_ input [mapping output])
+ (let [[mapping input'] (..relabel_instruction [mapping input])]
+ [mapping (row.suffix input' output)]))
+ [mapping (row.row)]
+ bytecode))
(def: fresh
Mapping
@@ -1033,7 +1033,7 @@
[_scope bodyA] (|> arguments'
(#.Item [self selfT])
list.reversed
- (list\fold scopeA.with_local (analyse archive bodyC))
+ (list\mix scopeA.with_local (analyse archive bodyC))
(typeA.with_type returnT)
analysis.with_scope)]
(in [privacy strict_floating_point? annotations method_tvars exceptions
@@ -1063,7 +1063,7 @@
[_scope bodyA] (|> arguments'
(#.Item [self selfT])
list.reversed
- (list\fold scopeA.with_local (analyse archive bodyC))
+ (list\mix scopeA.with_local (analyse archive bodyC))
(typeA.with_type returnT)
analysis.with_scope)]
(in [[super_name super_tvars] method_name strict_floating_point? annotations
@@ -1091,7 +1091,7 @@
[_scope bodyA] (|> arguments'
(#.Item [self selfT])
list.reversed
- (list\fold scopeA.with_local (analyse archive bodyC))
+ (list\mix scopeA.with_local (analyse archive bodyC))
(typeA.with_type returnT)
analysis.with_scope)]
(in [name privacy final? strict_floating_point? annotations method_tvars
@@ -1116,7 +1116,7 @@
returnT (//A.boxed_reflection_return mapping returnJ)
[_scope bodyA] (|> arguments'
list.reversed
- (list\fold scopeA.with_local (analyse archive bodyC))
+ (list\mix scopeA.with_local (analyse archive bodyC))
(typeA.with_type returnT)
analysis.with_scope)]
(in [name privacy strict_floating_point? annotations method_tvars
diff --git a/lux-jvm/source/luxc/lang/synthesis/variable.lux b/lux-jvm/source/luxc/lang/synthesis/variable.lux
index 4721187f8..f4e68d25b 100644
--- a/lux-jvm/source/luxc/lang/synthesis/variable.lux
+++ b/lux-jvm/source/luxc/lang/synthesis/variable.lux
@@ -2,7 +2,7 @@
lux
(lux (data [library
[number]]
- (coll [list "list/" Fold<List> Monoid<List>]
+ (coll [list "list/" Mix<List> Monoid<List>]
["s" set])))
(luxc (lang ["la" analysis]
["ls" synthesis]
@@ -47,7 +47,7 @@
(def: (unused-vars current-arity bound exprS)
(-> ls.Arity (List Variable) ls.Synthesis (List Variable))
(let [tracker (loop [exprS exprS
- tracker (list/fold s.has init-tracker bound)]
+ tracker (list/mix s.has init-tracker bound)]
(case exprS
(#ls.Variable var)
(if (non-arg? current-arity var)
@@ -58,14 +58,14 @@
(recur memberS tracker)
(#ls.Tuple membersS)
- (list/fold recur tracker membersS)
+ (list/mix recur tracker membersS)
(#ls.Call funcS argsS)
- (list/fold recur (recur funcS tracker) argsS)
+ (list/mix recur (recur funcS tracker) argsS)
(^or (#ls.Recur argsS)
(#ls.Procedure name argsS))
- (list/fold recur tracker argsS)
+ (list/mix recur tracker argsS)
(#ls.Let offset inputS outputS)
(|> tracker (recur inputS) (recur outputS))
@@ -74,16 +74,16 @@
(|> tracker (recur testS) (recur thenS) (recur elseS))
(#ls.Loop offset initsS bodyS)
- (recur bodyS (list/fold recur tracker initsS))
+ (recur bodyS (list/mix recur tracker initsS))
(#ls.Case inputS outputPS)
- (let [tracker' (list/fold s.has
- (recur inputS tracker)
- (bound-vars outputPS))]
- (list/fold recur tracker' (path-bodies outputPS)))
+ (let [tracker' (list/mix s.has
+ (recur inputS tracker)
+ (bound-vars outputPS))]
+ (list/mix recur tracker' (path-bodies outputPS)))
(#ls.Function arity env bodyS)
- (list/fold s.lacks tracker env)
+ (list/mix s.lacks tracker env)
_
tracker
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/case.lux b/lux-jvm/source/luxc/lang/translation/jvm/case.lux
index 3a6291036..eb1f37f0b 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/case.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/case.lux
@@ -8,7 +8,7 @@
["ex" exception (#+ exception:)]]
[data
[collection
- ["." list ("#@." fold)]]]
+ ["." list ("#@." mix)]]]
[math
[number
["n" nat]]]
@@ -132,21 +132,21 @@
[(<tag> cons)
(do {@ phase.monad}
[forkG (: (Operation Inst)
- (monad.fold @ (function (_ [test thenP] elseG)
- (do @
- [thenG (path' stack_depth @else @end phase archive thenP)]
- (in (<| _.with_label (function (_ @else))
- (|>> <dup>
- (<test> test)
- <comparison>
- (<if> @else)
- <pop>
- thenG
- (_.label @else)
- elseG)))))
- (|>> <pop>
- (_.GOTO @else))
- (#.Item cons)))]
+ (monad.mix @ (function (_ [test thenP] elseG)
+ (do @
+ [thenG (path' stack_depth @else @end phase archive thenP)]
+ (in (<| _.with_label (function (_ @else))
+ (|>> <dup>
+ (<test> test)
+ <comparison>
+ (<if> @else)
+ <pop>
+ thenG
+ (_.label @else)
+ elseG)))))
+ (|>> <pop>
+ (_.GOTO @else))
+ (#.Item cons)))]
(in (|>> peekI
<unwrap>
forkG)))])
@@ -266,16 +266,16 @@
(Generator [(List synthesis.Member) Synthesis])
(do phase.monad
[recordG (phase archive recordS)]
- (in (list@fold (function (_ step so_far)
- (.let [next (.case step
- (#.Left lefts)
- (..left_projection lefts)
-
- (#.Right lefts)
- (..right_projection lefts))]
- (|>> so_far next)))
- recordG
- (list.reversed path)))))
+ (in (list@mix (function (_ step so_far)
+ (.let [next (.case step
+ (#.Left lefts)
+ (..left_projection lefts)
+
+ (#.Right lefts)
+ (..right_projection lefts))]
+ (|>> so_far next)))
+ recordG
+ (list.reversed path)))))
(def: .public (case phase archive [valueS path])
(Generator [Synthesis Path])
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 31538a0bd..e2855e999 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
@@ -16,7 +16,7 @@
["." text ("#\." equivalence)
["%" format (#+ format)]]
[collection
- ["." list ("#\." monad fold)]
+ ["." list ("#\." monad mix)]
["." dictionary (#+ Dictionary)]
["." set]]]
[macro
@@ -1031,10 +1031,10 @@
(-> Nat (List (Type Value)) Inst)
(|> types
list.enumeration
- (list\fold (function (_ [lux_register type] [jvm_register before])
- (let [[jvm_register' after] (prepare_argument (n.+ offset lux_register) type jvm_register)]
- [jvm_register' (|>> before after)]))
- (: [Register Inst] [offset (|>>)]))
+ (list\mix (function (_ [lux_register type] [jvm_register before])
+ (let [[jvm_register' after] (prepare_argument (n.+ offset lux_register) type jvm_register)]
+ [jvm_register' (|>> before after)]))
+ (: [Register Inst] [offset (|>>)]))
product.right))
(def: .public (returnI returnT)
diff --git a/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux b/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux
index 77f5b34bc..f3af659fa 100644
--- a/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux
+++ b/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux
@@ -11,7 +11,7 @@
format]
[collection
["." array]
- [list ("list/" Fold<List>)]
+ [list ("list/" Mix<List>)]
["dict" dictionary]]]
[math
["r" random "r/" Monad<Random>]]
@@ -38,8 +38,8 @@
[... runtime-bytecode @runtime.translate
]
(default.with-scope
- (typeA.with-type output-type
- (_primitive.analyse (` ((~ (code.text procedure)) (~+ params)))))))
+ (typeA.with-type output-type
+ (_primitive.analyse (` ((~ (code.text procedure)) (~+ params)))))))
(analysis.with-current-module "")
(macro.result (initL.compiler []))
(case> (#e.Success _)
@@ -59,8 +59,8 @@
[... runtime-bytecode @runtime.translate
]
(default.with-scope
- (typeA.with-type output-type
- (_primitive.analyse syntax))))
+ (typeA.with-type output-type
+ (_primitive.analyse syntax))))
(analysis.with-current-module "")
(macro.result (initL.compiler []))
(case> (#e.Success _)
@@ -87,9 +87,9 @@
["jvm convert float-to-int" "java.lang.Float" hostAE.Integer]
["jvm convert float-to-long" "java.lang.Float" hostAE.Long]
)]
- ($_ seq
- <conversions>
- )))
+ ($_ seq
+ <conversions>
+ )))
(context: "Conversions [int]."
(with-expansions [<conversions> (template [<procedure> <from> <to>]
@@ -105,9 +105,9 @@
["jvm convert int-to-long" "java.lang.Integer" hostAE.Long]
["jvm convert int-to-short" "java.lang.Integer" hostAE.Short]
)]
- ($_ seq
- <conversions>
- )))
+ ($_ seq
+ <conversions>
+ )))
(context: "Conversions [long]."
(with-expansions [<conversions> (template [<procedure> <from> <to>]
@@ -122,9 +122,9 @@
["jvm convert long-to-short" "java.lang.Long" hostAE.Short]
["jvm convert long-to-byte" "java.lang.Long" hostAE.Byte]
)]
- ($_ seq
- <conversions>
- )))
+ ($_ seq
+ <conversions>
+ )))
(context: "Conversions [char + byte + short]."
(with-expansions [<conversions> (template [<procedure> <from> <to>]
@@ -140,9 +140,9 @@
["jvm convert byte-to-long" "java.lang.Byte" hostAE.Long]
["jvm convert short-to-long" "java.lang.Short" hostAE.Long]
)]
- ($_ seq
- <conversions>
- )))
+ ($_ seq
+ <conversions>
+ )))
(template [<domain> <boxed> <type>]
[(context: (format "Arithmetic " "[" <domain> "].")
@@ -159,9 +159,9 @@
[(format "jvm " <domain> " /") <boxed> <boxed> <type>]
[(format "jvm " <domain> " %") <boxed> <boxed> <type>]
)]
- ($_ seq
- <instructions>
- )))
+ ($_ seq
+ <instructions>
+ )))
(context: (format "Order " "[" <domain> "].")
(with-expansions [<instructions> (template [<procedure> <subject> <param> <output>]
@@ -174,9 +174,9 @@
[(format "jvm " <domain> " =") <boxed> <boxed> hostAE.Boolean]
[(format "jvm " <domain> " <") <boxed> <boxed> hostAE.Boolean]
)]
- ($_ seq
- <instructions>
- )))
+ ($_ seq
+ <instructions>
+ )))
(context: (format "Bitwise " "[" <domain> "].")
(with-expansions [<instructions> (template [<procedure> <subject> <param> <output>]
@@ -193,9 +193,9 @@
[(format "jvm " <domain> " shr") <boxed> "java.lang.Integer" <type>]
[(format "jvm " <domain> " ushr") <boxed> "java.lang.Integer" <type>]
)]
- ($_ seq
- <instructions>
- )))]
+ ($_ seq
+ <instructions>
+ )))]
["int" "java.lang.Integer" hostAE.Integer]
@@ -217,9 +217,9 @@
[(format "jvm " <domain> " /") <boxed> <boxed> <type>]
[(format "jvm " <domain> " %") <boxed> <boxed> <type>]
)]
- ($_ seq
- <instructions>
- )))
+ ($_ seq
+ <instructions>
+ )))
(context: (format "Order " "[" <domain> "].")
(with-expansions [<instructions> (template [<procedure> <subject> <param> <output>]
@@ -232,9 +232,9 @@
[(format "jvm " <domain> " =") <boxed> <boxed> hostAE.Boolean]
[(format "jvm " <domain> " <") <boxed> <boxed> hostAE.Boolean]
)]
- ($_ seq
- <instructions>
- )))]
+ ($_ seq
+ <instructions>
+ )))]
["float" "java.lang.Float" hostAE.Float]
@@ -253,9 +253,9 @@
[(format "jvm " <domain> " =") <boxed> <boxed> hostAE.Boolean]
[(format "jvm " <domain> " <") <boxed> <boxed> hostAE.Boolean]
)]
- ($_ seq
- <instructions>
- )))]
+ ($_ seq
+ <instructions>
+ )))]
["char" "java.lang.Character" hostAE.Character]
@@ -287,10 +287,10 @@
("jvm array new" (~ (code.nat size)))))
boxedT (#.Primitive boxed (list))
boxedTC (` (+0 (~ (code.text boxed)) (+0)))
- multi-arrayT (list/fold (function (_ _ innerT)
- (|> innerT (list) (#.Primitive "#Array")))
- boxedT
- (list.n/range +1 level))]]
+ multi-arrayT (list/mix (function (_ _ innerT)
+ (|> innerT (list) (#.Primitive "#Array")))
+ boxedT
+ (list.n/range +1 level))]]
($_ seq
(test "jvm array new"
(success "jvm array new"
diff --git a/lux-jvm/test/test/luxc/lang/synthesis/loop.lux b/lux-jvm/test/test/luxc/lang/synthesis/loop.lux
index 7aeafab5f..2b09fb3e7 100644
--- a/lux-jvm/test/test/luxc/lang/synthesis/loop.lux
+++ b/lux-jvm/test/test/luxc/lang/synthesis/loop.lux
@@ -4,7 +4,7 @@
(control [monad #+ do])
(data [bit "bit/" Eq<Bit>]
[number]
- (coll [list "list/" Functor<List> Fold<List>]
+ (coll [list "list/" Functor<List>]
(set ["set" unordered]))
text/format)
(macro [code])