aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore16
-rw-r--r--commands.md53
-rw-r--r--documentation/research/math.md1
-rw-r--r--lux-jvm/project.clj32
-rw-r--r--lux-jvm/source/luxc/lang/directive/jvm.lux (renamed from new-luxc/source/luxc/lang/directive/jvm.lux)0
-rw-r--r--lux-jvm/source/luxc/lang/host/jvm.lux (renamed from new-luxc/source/luxc/lang/host/jvm.lux)0
-rw-r--r--lux-jvm/source/luxc/lang/host/jvm/def.lux (renamed from new-luxc/source/luxc/lang/host/jvm/def.lux)0
-rw-r--r--lux-jvm/source/luxc/lang/host/jvm/inst.lux (renamed from new-luxc/source/luxc/lang/host/jvm/inst.lux)0
-rw-r--r--lux-jvm/source/luxc/lang/synthesis/variable.lux (renamed from new-luxc/source/luxc/lang/synthesis/variable.lux)0
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm.lux (renamed from new-luxc/source/luxc/lang/translation/jvm.lux)0
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/case.lux (renamed from new-luxc/source/luxc/lang/translation/jvm/case.lux)0
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/common.lux (renamed from new-luxc/source/luxc/lang/translation/jvm/common.lux)0
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/expression.lux (renamed from new-luxc/source/luxc/lang/translation/jvm/expression.lux)0
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/extension.lux (renamed from new-luxc/source/luxc/lang/translation/jvm/extension.lux)0
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux (renamed from new-luxc/source/luxc/lang/translation/jvm/extension/common.lux)0
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux (renamed from new-luxc/source/luxc/lang/translation/jvm/extension/host.lux)0
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/function.lux (renamed from new-luxc/source/luxc/lang/translation/jvm/function.lux)0
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/loop.lux (renamed from new-luxc/source/luxc/lang/translation/jvm/loop.lux)0
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/primitive.lux (renamed from new-luxc/source/luxc/lang/translation/jvm/primitive.lux)0
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/program.lux (renamed from new-luxc/source/luxc/lang/translation/jvm/program.lux)0
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/reference.lux (renamed from new-luxc/source/luxc/lang/translation/jvm/reference.lux)0
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/runtime.lux (renamed from new-luxc/source/luxc/lang/translation/jvm/runtime.lux)0
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/structure.lux (renamed from new-luxc/source/luxc/lang/translation/jvm/structure.lux)0
-rw-r--r--lux-jvm/source/program.lux (renamed from new-luxc/source/program.lux)0
-rw-r--r--lux-jvm/source/test/program.lux (renamed from new-luxc/source/test/program.lux)0
-rw-r--r--lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux (renamed from new-luxc/test/test/luxc/lang/analysis/host.jvm.lux)0
-rw-r--r--lux-jvm/test/test/luxc/lang/synthesis/loop.lux (renamed from new-luxc/test/test/luxc/lang/synthesis/loop.lux)0
-rw-r--r--lux-jvm/test/test/luxc/lang/synthesis/procedure.lux (renamed from new-luxc/test/test/luxc/lang/synthesis/procedure.lux)0
-rw-r--r--lux-jvm/test/test/luxc/lang/translation/js.lux (renamed from new-luxc/test/test/luxc/lang/translation/js.lux)0
-rw-r--r--lux-jvm/test/test/luxc/lang/translation/jvm.lux (renamed from new-luxc/test/test/luxc/lang/translation/jvm.lux)0
-rw-r--r--lux-r/project.clj (renamed from new-luxc/project.clj)4
-rw-r--r--lux-r/source/luxc/lang/host/r.lux (renamed from new-luxc/source/luxc/lang/host/r.lux)0
-rw-r--r--lux-r/source/luxc/lang/synthesis/variable.lux98
-rw-r--r--lux-r/source/luxc/lang/translation/r.lux (renamed from new-luxc/source/luxc/lang/translation/r.lux)0
-rw-r--r--lux-r/source/luxc/lang/translation/r/case.jvm.lux (renamed from new-luxc/source/luxc/lang/translation/r/case.jvm.lux)0
-rw-r--r--lux-r/source/luxc/lang/translation/r/expression.jvm.lux (renamed from new-luxc/source/luxc/lang/translation/r/expression.jvm.lux)0
-rw-r--r--lux-r/source/luxc/lang/translation/r/function.jvm.lux (renamed from new-luxc/source/luxc/lang/translation/r/function.jvm.lux)0
-rw-r--r--lux-r/source/luxc/lang/translation/r/loop.jvm.lux (renamed from new-luxc/source/luxc/lang/translation/r/loop.jvm.lux)0
-rw-r--r--lux-r/source/luxc/lang/translation/r/primitive.jvm.lux (renamed from new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux)0
-rw-r--r--lux-r/source/luxc/lang/translation/r/procedure/common.jvm.lux (renamed from new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux)0
-rw-r--r--lux-r/source/luxc/lang/translation/r/procedure/host.jvm.lux (renamed from new-luxc/source/luxc/lang/translation/r/procedure/host.jvm.lux)0
-rw-r--r--lux-r/source/luxc/lang/translation/r/reference.jvm.lux (renamed from new-luxc/source/luxc/lang/translation/r/reference.jvm.lux)0
-rw-r--r--lux-r/source/luxc/lang/translation/r/runtime.jvm.lux (renamed from new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux)0
-rw-r--r--lux-r/source/luxc/lang/translation/r/statement.jvm.lux (renamed from new-luxc/source/luxc/lang/translation/r/statement.jvm.lux)0
-rw-r--r--lux-r/source/luxc/lang/translation/r/structure.jvm.lux (renamed from new-luxc/source/luxc/lang/translation/r/structure.jvm.lux)0
-rw-r--r--lux-r/source/program.lux180
-rw-r--r--lux-r/source/test/program.lux18
47 files changed, 385 insertions, 17 deletions
diff --git a/.gitignore b/.gitignore
index 95dbbee14..0900603b4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,11 +16,11 @@ pom.xml.asc
/lux-lein/target
-/new-luxc/target
-/new-luxc/source/lux.lux
-/new-luxc/source/lux
-/new-luxc/source/program
-/new-luxc/source/spec
+/lux-jvm/target
+/lux-jvm/source/lux.lux
+/lux-jvm/source/lux
+/lux-jvm/source/program
+/lux-jvm/source/spec
/lux-js/target
/lux-js/source/lux.lux
@@ -64,3 +64,9 @@ pom.xml.asc
/lux-scheme/source/program
/lux-scheme/source/spec
+/lux-r/target
+/lux-r/source/lux.lux
+/lux-r/source/lux
+/lux-r/source/program
+/lux-r/source/spec
+
diff --git a/commands.md b/commands.md
index f29b148e3..2108bb873 100644
--- a/commands.md
+++ b/commands.md
@@ -270,35 +270,68 @@ cd ~/lux/lux-scheme/ && java -jar target/program.jar build --source ~/lux/stdlib
---
-# New compiler
+# R compiler
## Test
```
-cd ~/lux/new-luxc/ && lein lux auto test
-cd ~/lux/new-luxc/ && lein clean && lein lux auto test
+cd ~/lux/lux-r/ && lein lux auto test
+cd ~/lux/lux-r/ && lein clean && lein lux auto test
```
## Build
```
-cd ~/lux/new-luxc/ && lein lux auto build
-cd ~/lux/new-luxc/ && lein clean && lein lux auto build
+cd ~/lux/lux-r/ && lein lux auto build
+cd ~/lux/lux-r/ && lein clean && lein lux auto build
```
# REPL
```
-cd ~/lux/new-luxc/ && java -jar target/program.jar repl --source ~/lux/stdlib/source --target ~/lux/stdlib/target
+cd ~/lux/lux-r/ && java -jar target/program.jar repl --source ~/lux/stdlib/source --target ~/lux/stdlib/target
```
# Try
```
-cd ~/lux/new-luxc/ && time java -jar target/program.jar build --source ~/lux/stdlib/source --target ~/lux/stdlib/target --module test/lux
-cd ~/lux/stdlib/ && lein clean && cd ~/lux/new-luxc/ && time java -jar target/program.jar build --source ~/lux/stdlib/source --target ~/lux/stdlib/target --module test/lux
-cd ~/lux/stdlib/ && lein clean && cd ~/lux/new-luxc/ && time java -jar target/program.jar build --source ~/lux/stdlib/source --library ~/lux/stdlib/target/library.tar --target ~/lux/stdlib/target --module test/lux
-cd ~/lux/new-luxc/ && java -jar target/program.jar export --source ~/lux/stdlib/source --target ~/lux/stdlib/target
+cd ~/lux/lux-r/ && time java -jar target/program.jar build --source ~/lux/stdlib/source --target ~/lux/stdlib/target --module test/lux
+cd ~/lux/stdlib/ && lein clean && cd ~/lux/lux-r/ && time java -jar target/program.jar build --source ~/lux/stdlib/source --target ~/lux/stdlib/target --module test/lux
+cd ~/lux/stdlib/ && lein clean && cd ~/lux/lux-r/ && time java -jar target/program.jar build --source ~/lux/stdlib/source --library ~/lux/stdlib/target/library.tar --target ~/lux/stdlib/target --module test/lux
+cd ~/lux/lux-r/ && java -jar target/program.jar export --source ~/lux/stdlib/source --target ~/lux/stdlib/target
+
+cd ~/lux/stdlib/target/ && java -jar program.jar
+```
+
+# JVM compiler
+
+## Test
+
+```
+cd ~/lux/lux-jvm/ && lein lux auto test
+cd ~/lux/lux-jvm/ && lein clean && lein lux auto test
+```
+
+## Build
+
+```
+cd ~/lux/lux-jvm/ && lein lux auto build
+cd ~/lux/lux-jvm/ && lein clean && lein lux auto build
+```
+
+# REPL
+
+```
+cd ~/lux/lux-jvm/ && java -jar target/program.jar repl --source ~/lux/stdlib/source --target ~/lux/stdlib/target
+```
+
+# Try
+
+```
+cd ~/lux/lux-jvm/ && time java -jar target/program.jar build --source ~/lux/stdlib/source --target ~/lux/stdlib/target --module test/lux
+cd ~/lux/stdlib/ && lein clean && cd ~/lux/lux-jvm/ && time java -jar target/program.jar build --source ~/lux/stdlib/source --target ~/lux/stdlib/target --module test/lux
+cd ~/lux/stdlib/ && lein clean && cd ~/lux/lux-jvm/ && time java -jar target/program.jar build --source ~/lux/stdlib/source --library ~/lux/stdlib/target/library.tar --target ~/lux/stdlib/target --module test/lux
+cd ~/lux/lux-jvm/ && java -jar target/program.jar export --source ~/lux/stdlib/source --target ~/lux/stdlib/target
cd ~/lux/stdlib/target/ && java -jar program.jar
```
diff --git a/documentation/research/math.md b/documentation/research/math.md
index 91c434dca..572cd064a 100644
--- a/documentation/research/math.md
+++ b/documentation/research/math.md
@@ -160,6 +160,7 @@
# Geometric Algebra | Clifford Algebra
+1. [Projective Geometric Algebra Done Right](http://terathon.com/blog/projective-geometric-algebra-done-right/)
1. [Siggraph2019 Geometric Algebra](https://www.youtube.com/watch?v=tX4H_ctggYo)
1. [Introduction to Clifford Algebra](https://www.av8n.com/physics/clifford-intro.htm)
1. [An Introduction to Geometric Algebra over R^2](https://bitworking.org/news/ga/2d)
diff --git a/lux-jvm/project.clj b/lux-jvm/project.clj
new file mode 100644
index 000000000..dbff84a85
--- /dev/null
+++ b/lux-jvm/project.clj
@@ -0,0 +1,32 @@
+(def version "0.6.0-SNAPSHOT")
+(def repo "https://github.com/LuxLang/lux")
+(def sonatype "https://oss.sonatype.org")
+(def sonatype-releases (str sonatype "/service/local/staging/deploy/maven2/"))
+(def sonatype-snapshots (str sonatype "/content/repositories/snapshots/"))
+
+(defproject com.github.luxlang/lux-jvm #=(identity version)
+ :description "A JVM compiler for Lux."
+ :url ~repo
+ :license {:name "Lux License v0.1"
+ :url ~(str repo "/blob/master/license.txt")}
+ :plugins [[com.github.luxlang/lein-luxc ~version]]
+ :deploy-repositories [["releases" {:url ~sonatype-releases :creds :gpg}]
+ ["snapshots" {:url ~sonatype-snapshots :creds :gpg}]]
+ :pom-addition [:developers [:developer
+ [:name "Eduardo Julian"]
+ [:url "https://github.com/eduardoejp"]]]
+ :repositories [["releases" ~sonatype-releases]
+ ["snapshots" ~sonatype-snapshots]]
+ :scm {:name "git"
+ :url ~(str repo ".git")}
+
+ :dependencies [[com.github.luxlang/luxc-jvm ~version]
+ [com.github.luxlang/stdlib ~version]
+ ;; JVM Bytecode
+ [org.ow2.asm/asm-all "5.0.3"]]
+
+ :manifest {"lux" ~version}
+ :source-paths ["source"]
+ :lux {:program "program"
+ :test "test/program"}
+ )
diff --git a/new-luxc/source/luxc/lang/directive/jvm.lux b/lux-jvm/source/luxc/lang/directive/jvm.lux
index 27b1c8688..27b1c8688 100644
--- a/new-luxc/source/luxc/lang/directive/jvm.lux
+++ b/lux-jvm/source/luxc/lang/directive/jvm.lux
diff --git a/new-luxc/source/luxc/lang/host/jvm.lux b/lux-jvm/source/luxc/lang/host/jvm.lux
index d957bdb1d..d957bdb1d 100644
--- a/new-luxc/source/luxc/lang/host/jvm.lux
+++ b/lux-jvm/source/luxc/lang/host/jvm.lux
diff --git a/new-luxc/source/luxc/lang/host/jvm/def.lux b/lux-jvm/source/luxc/lang/host/jvm/def.lux
index f274da61f..f274da61f 100644
--- a/new-luxc/source/luxc/lang/host/jvm/def.lux
+++ b/lux-jvm/source/luxc/lang/host/jvm/def.lux
diff --git a/new-luxc/source/luxc/lang/host/jvm/inst.lux b/lux-jvm/source/luxc/lang/host/jvm/inst.lux
index b673c7d7e..b673c7d7e 100644
--- a/new-luxc/source/luxc/lang/host/jvm/inst.lux
+++ b/lux-jvm/source/luxc/lang/host/jvm/inst.lux
diff --git a/new-luxc/source/luxc/lang/synthesis/variable.lux b/lux-jvm/source/luxc/lang/synthesis/variable.lux
index f6a45b02e..f6a45b02e 100644
--- a/new-luxc/source/luxc/lang/synthesis/variable.lux
+++ b/lux-jvm/source/luxc/lang/synthesis/variable.lux
diff --git a/new-luxc/source/luxc/lang/translation/jvm.lux b/lux-jvm/source/luxc/lang/translation/jvm.lux
index 141e70184..141e70184 100644
--- a/new-luxc/source/luxc/lang/translation/jvm.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm.lux
diff --git a/new-luxc/source/luxc/lang/translation/jvm/case.lux b/lux-jvm/source/luxc/lang/translation/jvm/case.lux
index 0d8aaa91e..0d8aaa91e 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/case.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/case.lux
diff --git a/new-luxc/source/luxc/lang/translation/jvm/common.lux b/lux-jvm/source/luxc/lang/translation/jvm/common.lux
index 6cd7f4f2f..6cd7f4f2f 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/common.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/common.lux
diff --git a/new-luxc/source/luxc/lang/translation/jvm/expression.lux b/lux-jvm/source/luxc/lang/translation/jvm/expression.lux
index 144e35f9b..144e35f9b 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/expression.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/expression.lux
diff --git a/new-luxc/source/luxc/lang/translation/jvm/extension.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension.lux
index 9066dd156..9066dd156 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/extension.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/extension.lux
diff --git a/new-luxc/source/luxc/lang/translation/jvm/extension/common.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux
index 383415c0a..383415c0a 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/extension/common.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux
diff --git a/new-luxc/source/luxc/lang/translation/jvm/extension/host.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
index 7b90a8e4f..7b90a8e4f 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/extension/host.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
diff --git a/new-luxc/source/luxc/lang/translation/jvm/function.lux b/lux-jvm/source/luxc/lang/translation/jvm/function.lux
index 888ad9545..888ad9545 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/function.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/function.lux
diff --git a/new-luxc/source/luxc/lang/translation/jvm/loop.lux b/lux-jvm/source/luxc/lang/translation/jvm/loop.lux
index 1f2168fed..1f2168fed 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/loop.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/loop.lux
diff --git a/new-luxc/source/luxc/lang/translation/jvm/primitive.lux b/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux
index 873c363bd..873c363bd 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/primitive.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux
diff --git a/new-luxc/source/luxc/lang/translation/jvm/program.lux b/lux-jvm/source/luxc/lang/translation/jvm/program.lux
index 7ac897009..7ac897009 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/program.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/program.lux
diff --git a/new-luxc/source/luxc/lang/translation/jvm/reference.lux b/lux-jvm/source/luxc/lang/translation/jvm/reference.lux
index 6bcf4a2e5..6bcf4a2e5 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/reference.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/reference.lux
diff --git a/new-luxc/source/luxc/lang/translation/jvm/runtime.lux b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux
index a657a7a38..a657a7a38 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/runtime.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux
diff --git a/new-luxc/source/luxc/lang/translation/jvm/structure.lux b/lux-jvm/source/luxc/lang/translation/jvm/structure.lux
index 46f87142a..46f87142a 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/structure.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/structure.lux
diff --git a/new-luxc/source/program.lux b/lux-jvm/source/program.lux
index e2cf047e9..e2cf047e9 100644
--- a/new-luxc/source/program.lux
+++ b/lux-jvm/source/program.lux
diff --git a/new-luxc/source/test/program.lux b/lux-jvm/source/test/program.lux
index 270f9005d..270f9005d 100644
--- a/new-luxc/source/test/program.lux
+++ b/lux-jvm/source/test/program.lux
diff --git a/new-luxc/test/test/luxc/lang/analysis/host.jvm.lux b/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux
index f9905c8bc..f9905c8bc 100644
--- a/new-luxc/test/test/luxc/lang/analysis/host.jvm.lux
+++ b/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux
diff --git a/new-luxc/test/test/luxc/lang/synthesis/loop.lux b/lux-jvm/test/test/luxc/lang/synthesis/loop.lux
index c6efa7dbf..c6efa7dbf 100644
--- a/new-luxc/test/test/luxc/lang/synthesis/loop.lux
+++ b/lux-jvm/test/test/luxc/lang/synthesis/loop.lux
diff --git a/new-luxc/test/test/luxc/lang/synthesis/procedure.lux b/lux-jvm/test/test/luxc/lang/synthesis/procedure.lux
index ab6c9de6f..ab6c9de6f 100644
--- a/new-luxc/test/test/luxc/lang/synthesis/procedure.lux
+++ b/lux-jvm/test/test/luxc/lang/synthesis/procedure.lux
diff --git a/new-luxc/test/test/luxc/lang/translation/js.lux b/lux-jvm/test/test/luxc/lang/translation/js.lux
index 83108c594..83108c594 100644
--- a/new-luxc/test/test/luxc/lang/translation/js.lux
+++ b/lux-jvm/test/test/luxc/lang/translation/js.lux
diff --git a/new-luxc/test/test/luxc/lang/translation/jvm.lux b/lux-jvm/test/test/luxc/lang/translation/jvm.lux
index 7c97b1e78..7c97b1e78 100644
--- a/new-luxc/test/test/luxc/lang/translation/jvm.lux
+++ b/lux-jvm/test/test/luxc/lang/translation/jvm.lux
diff --git a/new-luxc/project.clj b/lux-r/project.clj
index 90ddecf12..138d826fe 100644
--- a/new-luxc/project.clj
+++ b/lux-r/project.clj
@@ -4,8 +4,8 @@
(def sonatype-releases (str sonatype "/service/local/staging/deploy/maven2/"))
(def sonatype-snapshots (str sonatype "/content/repositories/snapshots/"))
-(defproject com.github.luxlang/new-luxc #=(identity version)
- :description "A re-written compiler for Lux."
+(defproject com.github.luxlang/lux-r #=(identity version)
+ :description "An R compiler for Lux."
:url ~repo
:license {:name "Lux License v0.1"
:url ~(str repo "/blob/master/license.txt")}
diff --git a/new-luxc/source/luxc/lang/host/r.lux b/lux-r/source/luxc/lang/host/r.lux
index 6e4c7fb5b..6e4c7fb5b 100644
--- a/new-luxc/source/luxc/lang/host/r.lux
+++ b/lux-r/source/luxc/lang/host/r.lux
diff --git a/lux-r/source/luxc/lang/synthesis/variable.lux b/lux-r/source/luxc/lang/synthesis/variable.lux
new file mode 100644
index 000000000..f6a45b02e
--- /dev/null
+++ b/lux-r/source/luxc/lang/synthesis/variable.lux
@@ -0,0 +1,98 @@
+(.module:
+ lux
+ (lux (data [number]
+ (coll [list "list/" Fold<List> Monoid<List>]
+ ["s" set])))
+ (luxc (lang ["la" analysis]
+ ["ls" synthesis]
+ [".L" variable #+ Variable])))
+
+(def: (bound-vars path)
+ (-> ls.Path (List Variable))
+ (case path
+ (#ls.BindP register)
+ (list (.int register))
+
+ (^or (#ls.SeqP pre post) (#ls.AltP pre post))
+ (list/compose (bound-vars pre) (bound-vars post))
+
+ _
+ (list)))
+
+(def: (path-bodies path)
+ (-> ls.Path (List ls.Synthesis))
+ (case path
+ (#ls.ExecP body)
+ (list body)
+
+ (#ls.SeqP pre post)
+ (path-bodies post)
+
+ (#ls.AltP pre post)
+ (list/compose (path-bodies pre) (path-bodies post))
+
+ _
+ (list)))
+
+(def: (non-arg? arity var)
+ (-> ls.Arity Variable Bit)
+ (and (variableL.local? var)
+ (n/> arity (.nat var))))
+
+(type: Tracker (s.Set Variable))
+
+(def: init-tracker Tracker (s.new number.Hash<Int>))
+
+(def: (unused-vars current-arity bound exprS)
+ (-> ls.Arity (List Variable) ls.Synthesis (List Variable))
+ (let [tracker (loop [exprS exprS
+ tracker (list/fold s.add init-tracker bound)]
+ (case exprS
+ (#ls.Variable var)
+ (if (non-arg? current-arity var)
+ (s.remove var tracker)
+ tracker)
+
+ (#ls.Variant tag last? memberS)
+ (recur memberS tracker)
+
+ (#ls.Tuple membersS)
+ (list/fold recur tracker membersS)
+
+ (#ls.Call funcS argsS)
+ (list/fold recur (recur funcS tracker) argsS)
+
+ (^or (#ls.Recur argsS)
+ (#ls.Procedure name argsS))
+ (list/fold recur tracker argsS)
+
+ (#ls.Let offset inputS outputS)
+ (|> tracker (recur inputS) (recur outputS))
+
+ (#ls.If testS thenS elseS)
+ (|> tracker (recur testS) (recur thenS) (recur elseS))
+
+ (#ls.Loop offset initsS bodyS)
+ (recur bodyS (list/fold recur tracker initsS))
+
+ (#ls.Case inputS outputPS)
+ (let [tracker' (list/fold s.add
+ (recur inputS tracker)
+ (bound-vars outputPS))]
+ (list/fold recur tracker' (path-bodies outputPS)))
+
+ (#ls.Function arity env bodyS)
+ (list/fold s.remove tracker env)
+
+ _
+ tracker
+ ))]
+ (s.to-list tracker)))
+
+## (def: (optimize-register-use current-arity [pathS bodyS])
+## (-> ls.Arity [ls.Path ls.Synthesis] [ls.Path ls.Synthesis])
+## (let [bound (bound-vars pathS)
+## unused (unused-vars current-arity bound bodyS)
+## adjusted (adjust-vars unused bound)]
+## [(|> pathS (clean-pattern adjusted) simplify-pattern)
+## (clean-expression adjusted bodyS)]))
diff --git a/new-luxc/source/luxc/lang/translation/r.lux b/lux-r/source/luxc/lang/translation/r.lux
index a4a3db1f5..a4a3db1f5 100644
--- a/new-luxc/source/luxc/lang/translation/r.lux
+++ b/lux-r/source/luxc/lang/translation/r.lux
diff --git a/new-luxc/source/luxc/lang/translation/r/case.jvm.lux b/lux-r/source/luxc/lang/translation/r/case.jvm.lux
index 42460b620..42460b620 100644
--- a/new-luxc/source/luxc/lang/translation/r/case.jvm.lux
+++ b/lux-r/source/luxc/lang/translation/r/case.jvm.lux
diff --git a/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux b/lux-r/source/luxc/lang/translation/r/expression.jvm.lux
index 3c41fbe63..3c41fbe63 100644
--- a/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux
+++ b/lux-r/source/luxc/lang/translation/r/expression.jvm.lux
diff --git a/new-luxc/source/luxc/lang/translation/r/function.jvm.lux b/lux-r/source/luxc/lang/translation/r/function.jvm.lux
index f39a5e1a2..f39a5e1a2 100644
--- a/new-luxc/source/luxc/lang/translation/r/function.jvm.lux
+++ b/lux-r/source/luxc/lang/translation/r/function.jvm.lux
diff --git a/new-luxc/source/luxc/lang/translation/r/loop.jvm.lux b/lux-r/source/luxc/lang/translation/r/loop.jvm.lux
index f1197e5ce..f1197e5ce 100644
--- a/new-luxc/source/luxc/lang/translation/r/loop.jvm.lux
+++ b/lux-r/source/luxc/lang/translation/r/loop.jvm.lux
diff --git a/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux b/lux-r/source/luxc/lang/translation/r/primitive.jvm.lux
index 8bc7da848..8bc7da848 100644
--- a/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux
+++ b/lux-r/source/luxc/lang/translation/r/primitive.jvm.lux
diff --git a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux b/lux-r/source/luxc/lang/translation/r/procedure/common.jvm.lux
index 85ccd90dc..85ccd90dc 100644
--- a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux
+++ b/lux-r/source/luxc/lang/translation/r/procedure/common.jvm.lux
diff --git a/new-luxc/source/luxc/lang/translation/r/procedure/host.jvm.lux b/lux-r/source/luxc/lang/translation/r/procedure/host.jvm.lux
index 3bd33955f..3bd33955f 100644
--- a/new-luxc/source/luxc/lang/translation/r/procedure/host.jvm.lux
+++ b/lux-r/source/luxc/lang/translation/r/procedure/host.jvm.lux
diff --git a/new-luxc/source/luxc/lang/translation/r/reference.jvm.lux b/lux-r/source/luxc/lang/translation/r/reference.jvm.lux
index 7de1c74ee..7de1c74ee 100644
--- a/new-luxc/source/luxc/lang/translation/r/reference.jvm.lux
+++ b/lux-r/source/luxc/lang/translation/r/reference.jvm.lux
diff --git a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux b/lux-r/source/luxc/lang/translation/r/runtime.jvm.lux
index d641041d2..d641041d2 100644
--- a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux
+++ b/lux-r/source/luxc/lang/translation/r/runtime.jvm.lux
diff --git a/new-luxc/source/luxc/lang/translation/r/statement.jvm.lux b/lux-r/source/luxc/lang/translation/r/statement.jvm.lux
index 1798cb56d..1798cb56d 100644
--- a/new-luxc/source/luxc/lang/translation/r/statement.jvm.lux
+++ b/lux-r/source/luxc/lang/translation/r/statement.jvm.lux
diff --git a/new-luxc/source/luxc/lang/translation/r/structure.jvm.lux b/lux-r/source/luxc/lang/translation/r/structure.jvm.lux
index cea8fcd59..cea8fcd59 100644
--- a/new-luxc/source/luxc/lang/translation/r/structure.jvm.lux
+++ b/lux-r/source/luxc/lang/translation/r/structure.jvm.lux
diff --git a/lux-r/source/program.lux b/lux-r/source/program.lux
new file mode 100644
index 000000000..e2cf047e9
--- /dev/null
+++ b/lux-r/source/program.lux
@@ -0,0 +1,180 @@
+(.module:
+ [lux (#- Definition)
+ ["@" target]
+ ["." host (#+ import:)]
+ [abstract
+ [monad (#+ do)]]
+ [control
+ ["." io (#+ IO)]
+ ["." try (#+ Try)]
+ [parser
+ [cli (#+ program:)]]
+ [concurrency
+ ["." promise (#+ Promise)]]]
+ [data
+ ["." product]
+ [text
+ ["%" format (#+ format)]]
+ [collection
+ [array (#+ Array)]
+ ["." dictionary]]]
+ [world
+ ["." file]]
+ [target
+ [jvm
+ [bytecode (#+ Bytecode)]]]
+ [tool
+ [compiler
+ [default
+ ["." platform (#+ Platform)]]
+ [language
+ [lux
+ [analysis
+ ["." macro (#+ Expander)]]
+ [phase
+ [extension (#+ Phase Bundle Operation Handler Extender)
+ ["." analysis #_
+ ["#" jvm]]
+ ["." generation #_
+ ["#" jvm]]
+ ## ["." directive #_
+ ## ["#" jvm]]
+ ]
+ [generation
+ ["." jvm #_
+ ## ["." runtime (#+ Anchor Definition)]
+ ["." packager]
+ ## ["#/." host]
+ ]]]]]]]]
+ [program
+ ["/" compositor
+ ["/." cli]
+ ["/." static]]]
+ [luxc
+ [lang
+ [host
+ ["_" jvm]]
+ ["." directive #_
+ ["#" jvm]]
+ [translation
+ ["." jvm
+ ["." runtime]
+ ["." expression]
+ ["#/." program]
+ ["translation" extension]]]]])
+
+(import: #long java/lang/reflect/Method
+ (invoke [java/lang/Object [java/lang/Object]] #try java/lang/Object))
+
+(import: #long (java/lang/Class c)
+ (getMethod [java/lang/String [(java/lang/Class java/lang/Object)]] #try java/lang/reflect/Method))
+
+(import: #long java/lang/Object
+ (getClass [] (java/lang/Class java/lang/Object)))
+
+(def: _object-class
+ (java/lang/Class java/lang/Object)
+ (host.class-for java/lang/Object))
+
+(def: _apply2-args
+ (Array (java/lang/Class java/lang/Object))
+ (|> (host.array (java/lang/Class java/lang/Object) 2)
+ (host.array-write 0 _object-class)
+ (host.array-write 1 _object-class)))
+
+(def: _apply4-args
+ (Array (java/lang/Class java/lang/Object))
+ (|> (host.array (java/lang/Class java/lang/Object) 4)
+ (host.array-write 0 _object-class)
+ (host.array-write 1 _object-class)
+ (host.array-write 2 _object-class)
+ (host.array-write 3 _object-class)))
+
+(def: #export (expander macro inputs lux)
+ Expander
+ (do try.monad
+ [apply-method (|> macro
+ (:coerce java/lang/Object)
+ (java/lang/Object::getClass)
+ (java/lang/Class::getMethod "apply" _apply2-args))]
+ (:coerce (Try (Try [Lux (List Code)]))
+ (java/lang/reflect/Method::invoke
+ (:coerce java/lang/Object macro)
+ (|> (host.array java/lang/Object 2)
+ (host.array-write 0 (:coerce java/lang/Object inputs))
+ (host.array-write 1 (:coerce java/lang/Object lux)))
+ apply-method))))
+
+(def: #export platform
+ ## (IO (Platform Anchor (Bytecode Any) Definition))
+ (IO (Platform _.Anchor _.Inst _.Definition))
+ (do io.monad
+ [## host jvm/host.host
+ host jvm.host]
+ (wrap {#platform.&file-system (file.async file.system)
+ #platform.host host
+ ## #platform.phase jvm.generate
+ #platform.phase expression.translate
+ ## #platform.runtime runtime.generate
+ #platform.runtime runtime.translate
+ #platform.write product.right})))
+
+(def: extender
+ Extender
+ ## TODO: Stop relying on coercions ASAP.
+ (<| (:coerce Extender)
+ (function (@self handler))
+ (:coerce Handler)
+ (function (@self name phase))
+ (:coerce Phase)
+ (function (@self parameters))
+ (:coerce Operation)
+ (function (@self state))
+ (:coerce Try)
+ try.assume
+ (:coerce Try)
+ (do try.monad
+ [method (|> handler
+ (:coerce java/lang/Object)
+ (java/lang/Object::getClass)
+ (java/lang/Class::getMethod "apply" _apply4-args))]
+ (java/lang/reflect/Method::invoke
+ (:coerce java/lang/Object handler)
+ (|> (host.array java/lang/Object 4)
+ (host.array-write 0 (:coerce java/lang/Object name))
+ (host.array-write 1 (:coerce java/lang/Object phase))
+ (host.array-write 2 (:coerce java/lang/Object parameters))
+ (host.array-write 3 (:coerce java/lang/Object state)))
+ method))))
+
+(def: (target service)
+ (-> /cli.Service /cli.Target)
+ (case service
+ (^or (#/cli.Compilation [sources libraries target module])
+ (#/cli.Interpretation [sources libraries target module])
+ (#/cli.Export [sources target]))
+ target))
+
+(def: (declare-success! _)
+ (-> Any (Promise Any))
+ (promise.future (io.exit +0)))
+
+(program: [{service /cli.service}]
+ (let [jar-path (format (..target service) (:: file.system separator) "program.jar")]
+ (exec (do promise.monad
+ [_ (/.compiler {#/static.host @.jvm
+ #/static.host-module-extension ".jvm"
+ #/static.target (..target service)
+ #/static.artifact-extension ".class"}
+ ..expander
+ analysis.bundle
+ ..platform
+ ## generation.bundle
+ translation.bundle
+ (directive.bundle ..extender)
+ jvm/program.program
+ ..extender
+ service
+ [(packager.package jvm/program.class) jar-path])]
+ (..declare-success! []))
+ (io.io []))))
diff --git a/lux-r/source/test/program.lux b/lux-r/source/test/program.lux
new file mode 100644
index 000000000..270f9005d
--- /dev/null
+++ b/lux-r/source/test/program.lux
@@ -0,0 +1,18 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [control
+ ["." io]
+ [parser
+ [cli (#+ program:)]]]]
+ [spec
+ ["." compositor]]
+ {1
+ ["." /]})
+
+(program: args
+ (<| io.io
+ _.run!
+ ## (_.times 100)
+ (_.seed 1985013625126912890)
+ (compositor.spec /.jvm /.bundle /.expander /.program)))