aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--documentation/bookmark/commercialization/promotion.md4
-rw-r--r--documentation/bookmark/database.md1
-rw-r--r--documentation/bookmark/logging.md1
-rw-r--r--documentation/bookmark/math/geometry/bezier_curves.md1
-rw-r--r--documentation/bookmark/optimization.md1
-rw-r--r--documentation/bookmark/tool/text_editor.md4
-rw-r--r--documentation/bookmark/type_theory.md1
-rw-r--r--documentation/bookmark/web_framework.md1
-rw-r--r--lux-bootstrapper/project.clj6
-rw-r--r--lux-bootstrapper/src/lux/base.clj4
-rw-r--r--lux-bootstrapper/src/lux/compiler/jvm.clj4
-rw-r--r--lux-bootstrapper/src/lux/compiler/jvm/base.clj2
-rw-r--r--lux-bootstrapper/src/lux/compiler/jvm/case.clj16
-rw-r--r--lux-bootstrapper/src/lux/compiler/jvm/lux.clj8
-rw-r--r--lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj8
-rw-r--r--lux-bootstrapper/src/lux/compiler/jvm/rt.clj112
-rw-r--r--lux-bootstrapper/src/lux/host.clj7
-rw-r--r--lux-jvm-function/commands.md15
-rw-r--r--lux-jvm-function/dependency.jarbin0 -> 951 bytes
-rw-r--r--lux-jvm-function/dependency.pom85
-rw-r--r--lux-jvm/commands.md2
-rw-r--r--lux-jvm/project.clj4
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm.lux3
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/runtime.lux6
-rw-r--r--lux-lein/project.clj2
-rw-r--r--stdlib/commands.md2
-rw-r--r--stdlib/project.clj2
-rw-r--r--stdlib/project.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux92
30 files changed, 265 insertions, 138 deletions
diff --git a/.gitignore b/.gitignore
index 2bc0617f5..a745e6162 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,8 @@
/docs
pom.xml
pom.xml.asc
-*.jar
+program.jar
+aedifex.jar
*.class
/.lein-*
/.nrepl-port
diff --git a/documentation/bookmark/commercialization/promotion.md b/documentation/bookmark/commercialization/promotion.md
new file mode 100644
index 000000000..679ceba80
--- /dev/null
+++ b/documentation/bookmark/commercialization/promotion.md
@@ -0,0 +1,4 @@
+# Reference
+
+1. [How to promote your Github project](https://hackernoon.com/how-to-promote-your-github-project-1b39a7eee841)
+
diff --git a/documentation/bookmark/database.md b/documentation/bookmark/database.md
index 8c07f0279..20b367bfc 100644
--- a/documentation/bookmark/database.md
+++ b/documentation/bookmark/database.md
@@ -24,6 +24,7 @@
# Query
+1. ["Morel, a functional query language" by Julian Hyde](https://www.youtube.com/watch?v=smUm3C5q2IM)
1. [Comprehending Ringads](http://lambda-the-ultimate.org/node/5525)
1. [Reasons why SELECT * is bad for SQL performance](https://tanelpoder.com/posts/reasons-why-select-star-is-bad-for-sql-performance/)
1. [A Short Story About SQL’s Biggest Rival](https://www.holistics.io/blog/quel-vs-sql/)
diff --git a/documentation/bookmark/logging.md b/documentation/bookmark/logging.md
index 8f89b529e..5e7f4dc6c 100644
--- a/documentation/bookmark/logging.md
+++ b/documentation/bookmark/logging.md
@@ -1,5 +1,6 @@
# Reference
+1. [Structured Logging for Python](https://www.structlog.org/en/latest/)
1. [The Value of Correlation IDs](https://www.rapid7.com/blog/post/2016/12/23/the-value-of-correlation-ids/)
1. [IceCream — Never use print() to debug again](https://github.com/gruns/icecream)
1. [Capabilities of Elixir's Logger](https://blog.appsignal.com/2020/10/13/capabilities-of-elixir-logger.html)
diff --git a/documentation/bookmark/math/geometry/bezier_curves.md b/documentation/bookmark/math/geometry/bezier_curves.md
index c92aa1747..e8c36e995 100644
--- a/documentation/bookmark/math/geometry/bezier_curves.md
+++ b/documentation/bookmark/math/geometry/bezier_curves.md
@@ -1,5 +1,6 @@
# Reference
+1. [Curves and Surfaces](https://ciechanow.ski/curves-and-surfaces/)
1. [The Beauty of Bézier Curves](https://www.youtube.com/watch?v=aVwxzDHniEw)
1. [Circles and lines vs. polynomial splines](https://wordsandbuttons.online/circles_and_lines_vs_polynomial_splines.html)
1. https://cormullion.github.io/blog/2018/06/21/bezier.html
diff --git a/documentation/bookmark/optimization.md b/documentation/bookmark/optimization.md
index a0492fb9f..5ecf29694 100644
--- a/documentation/bookmark/optimization.md
+++ b/documentation/bookmark/optimization.md
@@ -8,6 +8,7 @@
# Compilation
+1. ["Outperforming Imperative with Pure Functional Languages" by Richard Feldman](https://www.youtube.com/watch?v=vzfy4EKwG_Y)
1. [CompilerGym: Making compiler optimizations accessible to all](https://ai.facebook.com/blog/compilergym-making-compiler-optimizations-accessible-to-all)
1. [Future Directions for Optimizing Compilers](https://arxiv.org/abs/1809.02161)
diff --git a/documentation/bookmark/tool/text_editor.md b/documentation/bookmark/tool/text_editor.md
index 43db79a29..2142fa0be 100644
--- a/documentation/bookmark/tool/text_editor.md
+++ b/documentation/bookmark/tool/text_editor.md
@@ -1,3 +1,7 @@
+# Modal editing
+
+1. [Beyond Vim and Emacs: A Scalable UI Paradigm](https://emacsconf.org/2020/talks/07/)
+
# Code navigation
1. ["Incremental, zero-config Code Nav using stack graphs" by Douglas Creager](https://www.youtube.com/watch?v=l2R1PTGcwrE)
diff --git a/documentation/bookmark/type_theory.md b/documentation/bookmark/type_theory.md
index b27a26a37..ee7af75b7 100644
--- a/documentation/bookmark/type_theory.md
+++ b/documentation/bookmark/type_theory.md
@@ -1,5 +1,6 @@
# Reference
+1. [A Sequent Calculus for Type Theory](http://www.cs.ru.nl/J.McKinna/RESEARCH/csl2006.pdf)
1. [Statically typed PostgreSQL queries in TypeScript](https://www.cs.mcgill.ca/~mxia3/2016/11/18/Statically-typed-PostgreSQL-queries-and-typescript-schemats/)
1. [Lambdas are Codatatypes](http://blog.ielliott.io/lambdas-are-codatatypes/)
1. [SPL LIFT— Statically Analyzing Software Product Linesin Minutes Instead of Years](https://www.bodden.de/pubs/bmb+13spllift.pdf)
diff --git a/documentation/bookmark/web_framework.md b/documentation/bookmark/web_framework.md
index 406a770a2..bfbc68245 100644
--- a/documentation/bookmark/web_framework.md
+++ b/documentation/bookmark/web_framework.md
@@ -28,6 +28,7 @@
# Exemplar
+1. ["Janus: Easy Complex UI with Declarative FRP" by Issa Tseng](https://www.youtube.com/watch?v=7S57O3VwIyQ)
1. https://github.com/alpinejs/alpine
1. [Mint: The programming language for writing single page applications.](https://www.mint-lang.com/)
1. [root: A recursive UI resolver](https://github.com/den1k/root)
diff --git a/lux-bootstrapper/project.clj b/lux-bootstrapper/project.clj
index 739d5c37c..2925b57d7 100644
--- a/lux-bootstrapper/project.clj
+++ b/lux-bootstrapper/project.clj
@@ -1,4 +1,6 @@
-(defproject com.github.luxlang/lux-bootstrapper "0.6.4"
+(def version "0.6.5-SNAPSHOT")
+
+(defproject com.github.luxlang/lux-bootstrapper #=(identity version)
:min-lein-version "2.1.0" ;; 2.1.0 introduced jar classifiers
:description "The JVM (bootstrapping) compiler for the Lux programming language."
:url "https://github.com/LuxLang/lux"
@@ -13,6 +15,8 @@
[:url "https://github.com/eduardoejp"]]]
:dependencies [[org.clojure/clojure "1.6.0"]
[org.clojure/core.match "0.2.1"]
+
+ [com.github.luxlang/lux-jvm-function ~version]
;; Prefer when building JS compiler.
[org.ow2.asm/asm "7.3.1"]
diff --git a/lux-bootstrapper/src/lux/base.clj b/lux-bootstrapper/src/lux/base.clj
index ca779a82a..42172b836 100644
--- a/lux-bootstrapper/src/lux/base.clj
+++ b/lux-bootstrapper/src/lux/base.clj
@@ -1193,7 +1193,7 @@
(assoc output index (rem raw 10))
(int (/ raw 10))))
output)))]
- ;; Based on the LuxRT.encode_rev method
+ ;; Based on the Runtime.encode_rev method
(defn encode-rev [input]
(if (= 0 input)
".0"
@@ -1211,7 +1211,7 @@
(.split "0*$")
(aget 0))))))
- ;; Based on the LuxRT.decode_rev method
+ ;; Based on the Runtime.decode_rev method
(defn decode-rev [^String input]
(if (and (.startsWith input ".")
(<= (.length input) (inc rev-bits)))
diff --git a/lux-bootstrapper/src/lux/compiler/jvm.clj b/lux-bootstrapper/src/lux/compiler/jvm.clj
index 7a547dcd3..ebef7c418 100644
--- a/lux-bootstrapper/src/lux/compiler/jvm.clj
+++ b/lux-bootstrapper/src/lux/compiler/jvm.clj
@@ -189,8 +189,8 @@
module-class-name nil "java/lang/Object" nil)
(.visitSource file-name nil))]
_ (if (= &/prelude name)
- (|do [_ &&rt/compile-Function-class
- _ &&rt/compile-LuxRT-class]
+ (|do [;; _ &&rt/compile-Function-class
+ _ &&rt/compile-Runtime-class]
(return nil))
(return nil))
:let [compiler-step (&analyser/analyse &optimizer/optimize eval! compile-module!! all-compilers)]]
diff --git a/lux-bootstrapper/src/lux/compiler/jvm/base.clj b/lux-bootstrapper/src/lux/compiler/jvm/base.clj
index 47566a626..f9cdc411d 100644
--- a/lux-bootstrapper/src/lux/compiler/jvm/base.clj
+++ b/lux-bootstrapper/src/lux/compiler/jvm/base.clj
@@ -38,7 +38,7 @@
(str "(" (apply str (repeat n "Ljava/lang/Object;")) ")Ljava/lang/Object;"))
(def ^:const num-apply-variants 8)
(def ^:const arity-field "_arity_")
-(def ^:const partials-field "_partials_")
+(def ^:const partials-field "partials")
;; [Utils]
(defn ^:private write-output [module name data]
diff --git a/lux-bootstrapper/src/lux/compiler/jvm/case.clj b/lux-bootstrapper/src/lux/compiler/jvm/case.clj
index 6bd9a3824..3858dbde2 100644
--- a/lux-bootstrapper/src/lux/compiler/jvm/case.clj
+++ b/lux-bootstrapper/src/lux/compiler/jvm/case.clj
@@ -114,21 +114,21 @@
#(doto ^MethodVisitor %
(.visitInsn Opcodes/AALOAD))
#(doto ^MethodVisitor %
- (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "tuple_left" "([Ljava/lang/Object;I)Ljava/lang/Object;")))]
+ (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "tuple_left" "([Ljava/lang/Object;I)Ljava/lang/Object;")))]
(doto writer
stack-peek
(.visitTypeInsn Opcodes/CHECKCAST "[Ljava/lang/Object;")
(.visitLdcInsn (int lefts))
accessI
- (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "pm_stack_push" "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")))
+ (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "pm_stack_push" "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")))
(&o/$TuplePM (&/$Right _idx))
(doto writer
stack-peek
(.visitTypeInsn Opcodes/CHECKCAST "[Ljava/lang/Object;")
(.visitLdcInsn (int (dec _idx)))
- (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "tuple_right" "([Ljava/lang/Object;I)Ljava/lang/Object;")
- (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "pm_stack_push" "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;"))
+ (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "tuple_right" "([Ljava/lang/Object;I)Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "pm_stack_push" "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;"))
(&o/$VariantPM _idx+)
(|let [$success (new Label)
@@ -147,7 +147,7 @@
(.visitLdcInsn writer "")
(.visitInsn writer Opcodes/ACONST_NULL))]
(doto writer
- (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "sum_get" "([Ljava/lang/Object;ILjava/lang/Object;)Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "sum_get" "([Ljava/lang/Object;ILjava/lang/Object;)Ljava/lang/Object;")
(.visitInsn Opcodes/DUP)
(.visitJumpInsn Opcodes/IFNULL $fail)
(.visitJumpInsn Opcodes/GOTO $success)
@@ -155,7 +155,7 @@
(.visitInsn Opcodes/POP)
(.visitJumpInsn Opcodes/GOTO $else)
(.visitLabel $success)
- (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "pm_stack_push" "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")))
+ (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "pm_stack_push" "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")))
(&o/$SeqPM _left-pm _right-pm)
(doto writer
@@ -178,7 +178,7 @@
(compile-pattern* bodies 1 $else pm)
(.visitLabel $else)
(.visitInsn Opcodes/POP)
- (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "pm_fail" "()V")
+ (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "pm_fail" "()V")
(.visitInsn Opcodes/ACONST_NULL)
(.visitJumpInsn Opcodes/GOTO $end))))
@@ -200,7 +200,7 @@
(.visitInsn Opcodes/ACONST_NULL))]
_ (compile ?value)
:let [_ (doto *writer*
- (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "pm_stack_push" "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;"))
+ (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "pm_stack_push" "([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;"))
_ (compile-pattern *writer* bodies-labels ?pm $end)]
_ (compile-bodies *writer* compile bodies-labels ?bodies $end)
:let [_ (.visitLabel *writer* $end)]]
diff --git a/lux-bootstrapper/src/lux/compiler/jvm/lux.clj b/lux-bootstrapper/src/lux/compiler/jvm/lux.clj
index 279fd119a..4617f7e2e 100644
--- a/lux-bootstrapper/src/lux/compiler/jvm/lux.clj
+++ b/lux-bootstrapper/src/lux/compiler/jvm/lux.clj
@@ -82,7 +82,7 @@
(.visitLdcInsn *writer* "")
(.visitInsn *writer* Opcodes/ACONST_NULL))]
_ (compile value)
- :let [_ (.visitMethodInsn *writer* Opcodes/INVOKESTATIC &rt/rt-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")]]
+ :let [_ (.visitMethodInsn *writer* Opcodes/INVOKESTATIC &rt/runtime-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")]]
(return nil)))
(defn compile-local [compile ?idx]
@@ -211,7 +211,7 @@
(.visitLdcInsn (int (if tail?
(dec idx)
idx)))
- (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class
+ (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class
(if tail? "tuple_right" "tuple_left")
"([Ljava/lang/Object;I)Ljava/lang/Object;"))))
_path)]]
@@ -347,7 +347,7 @@
(.visitLdcInsn (->> #'&/$End meta ::&/lefts int)) ;; I
(.visitInsn Opcodes/ACONST_NULL) ;; I?
(.visitLdcInsn &/unit-tag) ;; I?U
- (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;") ;; V
+ (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;") ;; V
;; Tail: End
;; Size: Begin
(.visitVarInsn Opcodes/ALOAD 0) ;; VA
@@ -387,7 +387,7 @@
(.visitLdcInsn "") ;; I2I?
(.visitInsn Opcodes/DUP2_X1) ;; II?2I?
(.visitInsn Opcodes/POP2) ;; II?2
- (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;") ;; IV
+ (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;") ;; IV
;; Item: End
(.visitInsn Opcodes/SWAP) ;; VI
(.visitJumpInsn Opcodes/GOTO $loop)
diff --git a/lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj b/lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj
index 642bd3427..fc1257a3e 100644
--- a/lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj
+++ b/lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj
@@ -83,7 +83,7 @@
_ (compile ?op)
:let [_ (doto *writer*
(.visitTypeInsn Opcodes/CHECKCAST &rt/function-class)
- (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "runTry" (str "(L" &rt/function-class ";)[Ljava/lang/Object;")))]]
+ (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "runTry" (str "(L" &rt/function-class ";)[Ljava/lang/Object;")))]]
(return nil)))
(do-template [<name> <opcode> <unwrap> <wrap>]
@@ -161,7 +161,7 @@
_ (compile ?input)
:let [_ (doto *writer*
(.visitTypeInsn Opcodes/CHECKCAST "java/lang/String")
- (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "decode_frac" "(Ljava/lang/String;)[Ljava/lang/Object;"))]]
+ (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "decode_frac" "(Ljava/lang/String;)[Ljava/lang/Object;"))]]
(return nil)))
(defn ^:private compile-int-char [compile ?values special-args]
@@ -277,11 +277,11 @@
(.visitJumpInsn Opcodes/IF_ICMPEQ $not-found)
(.visitInsn Opcodes/I2L)
&&/wrap-long
- (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "make_some" "(Ljava/lang/Object;)[Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "make_some" "(Ljava/lang/Object;)[Ljava/lang/Object;")
(.visitJumpInsn Opcodes/GOTO $end)
(.visitLabel $not-found)
(.visitInsn Opcodes/POP)
- (.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "make_none" "()[Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC &rt/runtime-class "make_none" "()[Ljava/lang/Object;")
(.visitLabel $end))]]
(return nil)))
diff --git a/lux-bootstrapper/src/lux/compiler/jvm/rt.clj b/lux-bootstrapper/src/lux/compiler/jvm/rt.clj
index 23b7c1be9..c8c3a522a 100644
--- a/lux-bootstrapper/src/lux/compiler/jvm/rt.clj
+++ b/lux-bootstrapper/src/lux/compiler/jvm/rt.clj
@@ -21,7 +21,7 @@
MethodVisitor
AnnotationVisitor)))
-(def ^:const ^String rt-class
+(def ^:const ^String runtime-class
&&/lux-utils-class)
(def ^:const ^String function-class
@@ -32,45 +32,45 @@
;; [Resources]
;; Functions
-(def compile-Function-class
- (|do [_ (return nil)
- :let [super-class "java/lang/Object"
- =class (doto (new ClassWriter ClassWriter/COMPUTE_MAXS)
- (.visit &host/bytecode-version (+ Opcodes/ACC_PUBLIC Opcodes/ACC_SUPER
- Opcodes/ACC_ABSTRACT
- ;; Opcodes/ACC_INTERFACE
- )
- &&/function-class nil super-class (into-array String []))
- (-> (.visitField (+ Opcodes/ACC_PUBLIC Opcodes/ACC_FINAL) &&/partials-field "I" nil nil)
- (doto (.visitEnd))))
- =init-method (doto (.visitMethod =class Opcodes/ACC_PUBLIC init-method "(I)V" nil nil)
- (.visitCode)
- (.visitVarInsn Opcodes/ALOAD 0)
- (.visitMethodInsn Opcodes/INVOKESPECIAL super-class init-method "()V")
- (.visitVarInsn Opcodes/ALOAD 0)
- (.visitVarInsn Opcodes/ILOAD 1)
- (.visitFieldInsn Opcodes/PUTFIELD &&/function-class &&/partials-field "I")
- (.visitInsn Opcodes/RETURN)
- (.visitMaxs 0 0)
- (.visitEnd))
- _ (dotimes [arity* &&/num-apply-variants]
- (let [arity (inc arity*)]
- (if (= 1 arity)
- (doto (.visitMethod =class (+ Opcodes/ACC_PUBLIC Opcodes/ACC_ABSTRACT) &&/apply-method (&&/apply-signature arity) nil nil)
- (.visitEnd))
- (doto (.visitMethod =class Opcodes/ACC_PUBLIC &&/apply-method (&&/apply-signature arity) nil nil)
- (.visitCode)
- (-> (.visitVarInsn Opcodes/ALOAD idx)
- (->> (dotimes [idx arity])))
- (.visitMethodInsn Opcodes/INVOKEVIRTUAL &&/function-class &&/apply-method (&&/apply-signature (dec arity)))
- (.visitTypeInsn Opcodes/CHECKCAST &&/function-class)
- (.visitVarInsn Opcodes/ALOAD arity)
- (.visitMethodInsn Opcodes/INVOKEVIRTUAL &&/function-class &&/apply-method (&&/apply-signature 1))
- (.visitInsn Opcodes/ARETURN)
- (.visitMaxs 0 0)
- (.visitEnd)))))]]
- (&&/save-class! (-> &&/function-class (string/split #"/") (nth 2))
- (.toByteArray (doto =class .visitEnd)))))
+;; (def compile-Function-class
+;; (|do [_ (return nil)
+;; :let [super-class "java/lang/Object"
+;; =class (doto (new ClassWriter ClassWriter/COMPUTE_MAXS)
+;; (.visit &host/bytecode-version (+ Opcodes/ACC_PUBLIC Opcodes/ACC_SUPER
+;; Opcodes/ACC_ABSTRACT
+;; ;; Opcodes/ACC_INTERFACE
+;; )
+;; &&/function-class nil super-class (into-array String []))
+;; (-> (.visitField (+ Opcodes/ACC_PUBLIC Opcodes/ACC_FINAL) &&/partials-field "I" nil nil)
+;; (doto (.visitEnd))))
+;; =init-method (doto (.visitMethod =class Opcodes/ACC_PUBLIC init-method "(I)V" nil nil)
+;; (.visitCode)
+;; (.visitVarInsn Opcodes/ALOAD 0)
+;; (.visitMethodInsn Opcodes/INVOKESPECIAL super-class init-method "()V")
+;; (.visitVarInsn Opcodes/ALOAD 0)
+;; (.visitVarInsn Opcodes/ILOAD 1)
+;; (.visitFieldInsn Opcodes/PUTFIELD &&/function-class &&/partials-field "I")
+;; (.visitInsn Opcodes/RETURN)
+;; (.visitMaxs 0 0)
+;; (.visitEnd))
+;; _ (dotimes [arity* &&/num-apply-variants]
+;; (let [arity (inc arity*)]
+;; (if (= 1 arity)
+;; (doto (.visitMethod =class (+ Opcodes/ACC_PUBLIC Opcodes/ACC_ABSTRACT) &&/apply-method (&&/apply-signature arity) nil nil)
+;; (.visitEnd))
+;; (doto (.visitMethod =class Opcodes/ACC_PUBLIC &&/apply-method (&&/apply-signature arity) nil nil)
+;; (.visitCode)
+;; (-> (.visitVarInsn Opcodes/ALOAD idx)
+;; (->> (dotimes [idx arity])))
+;; (.visitMethodInsn Opcodes/INVOKEVIRTUAL &&/function-class &&/apply-method (&&/apply-signature (dec arity)))
+;; (.visitTypeInsn Opcodes/CHECKCAST &&/function-class)
+;; (.visitVarInsn Opcodes/ALOAD arity)
+;; (.visitMethodInsn Opcodes/INVOKEVIRTUAL &&/function-class &&/apply-method (&&/apply-signature 1))
+;; (.visitInsn Opcodes/ARETURN)
+;; (.visitMaxs 0 0)
+;; (.visitEnd)))))]]
+;; (&&/save-class! (-> &&/function-class (string/split #"/") (nth 2))
+;; (.toByteArray (doto =class .visitEnd)))))
(defmacro <bytecode> [& instructions]
`(fn [^MethodVisitor writer#]
@@ -78,7 +78,7 @@
~@instructions)))
;; Runtime infrastructure
-(defn ^:private compile-LuxRT-adt-methods [^ClassWriter =class]
+(defn ^:private compile-Runtime-adt-methods [^ClassWriter =class]
(|let [lefts #(doto ^MethodVisitor %
(.visitVarInsn Opcodes/ILOAD 1))
tuple-size #(doto ^MethodVisitor %
@@ -178,7 +178,7 @@
super-nested (<bytecode> super-nested-lefts ;; super-lefts
!variant <>right? ;; super-lefts, super-right?
!variant <>value ;; super-lefts, super-right?, super-value
- (.visitMethodInsn Opcodes/INVOKESTATIC rt-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;"))
+ (.visitMethodInsn Opcodes/INVOKESTATIC runtime-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;"))
update-!variant (<bytecode> !variant <>value
(.visitTypeInsn Opcodes/CHECKCAST "[Ljava/lang/Object;")
@@ -271,18 +271,18 @@
(.visitVarInsn Opcodes/ALOAD 0)
(.visitMethodInsn Opcodes/INVOKESTATIC <class> <parse-method> <signature>)
<wrapper>
- (.visitMethodInsn Opcodes/INVOKESTATIC rt-class "make_some" "(Ljava/lang/Object;)[Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC runtime-class "make_some" "(Ljava/lang/Object;)[Ljava/lang/Object;")
(.visitInsn Opcodes/ARETURN)
(.visitLabel $to)
(.visitLabel $handler)
- (.visitMethodInsn Opcodes/INVOKESTATIC rt-class "make_none" "()[Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC runtime-class "make_none" "()[Ljava/lang/Object;")
(.visitInsn Opcodes/ARETURN)
(.visitMaxs 0 0)
(.visitEnd)))
nil))
- ^:private compile-LuxRT-int-methods "decode_int" "java/lang/Long" "parseLong" "(Ljava/lang/String;)J" &&/wrap-long
- ^:private compile-LuxRT-frac-methods "decode_frac" "java/lang/Double" "parseDouble" "(Ljava/lang/String;)D" &&/wrap-double
+ ^:private compile-Runtime-int-methods "decode_int" "java/lang/Long" "parseLong" "(Ljava/lang/String;)J" &&/wrap-long
+ ^:private compile-Runtime-frac-methods "decode_frac" "java/lang/Double" "parseDouble" "(Ljava/lang/String;)D" &&/wrap-double
)
(defn peekI [^MethodVisitor writer]
@@ -296,7 +296,7 @@
(.visitInsn Opcodes/AALOAD)
(.visitTypeInsn Opcodes/CHECKCAST "[Ljava/lang/Object;")))
-(defn ^:private compile-LuxRT-pm-methods [^ClassWriter =class]
+(defn ^:private compile-Runtime-pm-methods [^ClassWriter =class]
(|let [_ (doto (.visitMethod =class (+ Opcodes/ACC_PUBLIC Opcodes/ACC_STATIC) "pm_fail" "()V" nil nil)
(.visitCode)
(.visitTypeInsn Opcodes/NEW "java/lang/IllegalStateException")
@@ -323,7 +323,7 @@
(.visitEnd))]
nil))
-(def compile-LuxRT-class
+(def compile-Runtime-class
(|do [_ (return nil)
:let [full-name &&/lux-utils-class
super-class (&host-generics/->bytecode-class-name "java.lang.Object")
@@ -357,7 +357,7 @@
(.visitLdcInsn (->> #'&/$None meta ::&/lefts int)) ;; I
(.visitInsn Opcodes/ACONST_NULL) ;; I?
(.visitLdcInsn &/unit-tag) ;; I?U
- (.visitMethodInsn Opcodes/INVOKESTATIC rt-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC runtime-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")
(.visitInsn Opcodes/ARETURN)
(.visitMaxs 0 0)
(.visitEnd))
@@ -366,7 +366,7 @@
(.visitLdcInsn (->> #'&/$Some meta ::&/lefts int)) ;; I
(.visitLdcInsn "") ;; I?
(.visitVarInsn Opcodes/ALOAD 0) ;; I?O
- (.visitMethodInsn Opcodes/INVOKESTATIC rt-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC runtime-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")
(.visitInsn Opcodes/ARETURN)
(.visitMaxs 0 0)
(.visitEnd))
@@ -406,7 +406,7 @@
(.visitVarInsn Opcodes/ALOAD 0)
(.visitInsn Opcodes/ACONST_NULL)
(.visitMethodInsn Opcodes/INVOKEVIRTUAL function-class &&/apply-method (&&/apply-signature 1))
- (.visitMethodInsn Opcodes/INVOKESTATIC rt-class "make_some" "(Ljava/lang/Object;)[Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC runtime-class "make_some" "(Ljava/lang/Object;)[Ljava/lang/Object;")
(.visitInsn Opcodes/ARETURN)
(.visitLabel $to)
(.visitLabel $handler) ;; T
@@ -419,14 +419,14 @@
(.visitLdcInsn (->> #'&/$Left meta ::&/lefts int)) ;; SI
(.visitInsn Opcodes/ACONST_NULL) ;; SI?
swap2x1 ;; I?S
- (.visitMethodInsn Opcodes/INVOKESTATIC rt-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")
+ (.visitMethodInsn Opcodes/INVOKESTATIC runtime-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")
(.visitInsn Opcodes/ARETURN)
(.visitMaxs 0 0)
(.visitEnd)))
_ (doto =class
- (compile-LuxRT-pm-methods)
- (compile-LuxRT-adt-methods)
- (compile-LuxRT-int-methods)
- (compile-LuxRT-frac-methods))]]
+ (compile-Runtime-pm-methods)
+ (compile-Runtime-adt-methods)
+ (compile-Runtime-int-methods)
+ (compile-Runtime-frac-methods))]]
(&&/save-class! (-> &&/lux-utils-class (string/split #"/") (nth 2))
(.toByteArray (doto =class .visitEnd)))))
diff --git a/lux-bootstrapper/src/lux/host.clj b/lux-bootstrapper/src/lux/host.clj
index 4d49a6262..00763ade3 100644
--- a/lux-bootstrapper/src/lux/host.clj
+++ b/lux-bootstrapper/src/lux/host.clj
@@ -26,11 +26,14 @@
(defn ^String internal [^String external]
(.replace external class-name-separator class-separator))
+(defn ^String fundamental-class [^String name]
+ (str (external &/prelude) class-name-separator name))
+
(def ^:const ^String function-class
- (str (external &/prelude) class-name-separator "Function"))
+ (fundamental-class "Function"))
(def ^:const ^String lux-utils-class
- (str (external &/prelude) class-name-separator "LuxRT"))
+ (fundamental-class "Runtime"))
;; [Resources]
(defn ^String ->module-class [old]
diff --git a/lux-jvm-function/commands.md b/lux-jvm-function/commands.md
new file mode 100644
index 000000000..a82070bc6
--- /dev/null
+++ b/lux-jvm-function/commands.md
@@ -0,0 +1,15 @@
+# Deploy
+
+```
+cd ~/lux/lux-jvm-function/ \
+&& mvn install:install-file -Dfile=dependency.jar -DgroupId=com.github.luxlang -DartifactId=lux-jvm-function -Dversion=0.6.5-SNAPSHOT -Dpackaging=jar
+
+cd ~/lux/lux-jvm/ && mvn deploy:deploy-file \
+-Durl=https://<username>:<password>@oss.sonatype.org/content/repositories/snapshots/ \
+-Dfile=target/program.jar \
+-DgroupId=com.github.luxlang \
+-DartifactId=lux-jvm \
+-Dversion=0.6.1-SNAPSHOT \
+-Dpackaging=jar
+```
+
diff --git a/lux-jvm-function/dependency.jar b/lux-jvm-function/dependency.jar
new file mode 100644
index 000000000..500384906
--- /dev/null
+++ b/lux-jvm-function/dependency.jar
Binary files differ
diff --git a/lux-jvm-function/dependency.pom b/lux-jvm-function/dependency.pom
new file mode 100644
index 000000000..1c826547f
--- /dev/null
+++ b/lux-jvm-function/dependency.pom
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.github.luxlang</groupId>
+ <artifactId>lux-jvm-function</artifactId>
+ <packaging>jar</packaging>
+ <version>0.6.5-SNAPSHOT</version>
+ <name>lux-jvm-function</name>
+ <description>Function abstract class for the JVM compiler.</description>
+ <url>https://github.com/LuxLang/lux</url>
+ <licenses>
+ <license>
+ <name>Lux License v0.1.2</name>
+ <url>https://github.com/LuxLang/lux/blob/master/license.txt</url>
+ </license>
+ </licenses>
+ <scm>
+ <url>https://github.com/LuxLang/lux.git</url>
+ </scm>
+ <build>
+ <sourceDirectory>source</sourceDirectory>
+ <testSourceDirectory>test</testSourceDirectory>
+ <resources>
+ <resource>
+ <directory>resources</directory>
+ </resource>
+ </resources>
+ <testResources>
+ <testResource>
+ <directory>resources</directory>
+ </testResource>
+ </testResources>
+ <directory>target</directory>
+ <outputDirectory>target/classes</outputDirectory>
+ <plugins/>
+ </build>
+ <repositories>
+ <repository>
+ <id>central</id>
+ <url>https://repo1.maven.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ </repository>
+ <repository>
+ <id>clojars</id>
+ <url>https://repo.clojars.org/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ </repository>
+ <repository>
+ <id>snapshots</id>
+ <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ </repository>
+ </repositories>
+ <dependencyManagement>
+ <dependencies/>
+ </dependencyManagement>
+ <dependencies>
+ </dependencies>
+ <developers>
+ <developer>
+ <name>Eduardo Julian</name>
+ <url>https://github.com/eduardoejp</url>
+ </developer>
+ </developers>
+</project>
+
+<!-- This file was autogenerated by Leiningen.
+ Please do not edit it directly; instead edit project.clj and regenerate it.
+ It should not be considered canonical data. For more information see
+ https://github.com/technomancy/leiningen -->
diff --git a/lux-jvm/commands.md b/lux-jvm/commands.md
index 1d3c9dec1..81a36643a 100644
--- a/lux-jvm/commands.md
+++ b/lux-jvm/commands.md
@@ -40,7 +40,7 @@ cd ~/lux/stdlib/ \
```
cd ~/lux/lux-jvm/ \
-&& mvn install:install-file -Dfile=target/program.jar -DgroupId=com.github.luxlang -DartifactId=lux-jvm -Dversion=0.6.3 -Dpackaging=jar
+&& mvn install:install-file -Dfile=target/program.jar -DgroupId=com.github.luxlang -DartifactId=lux-jvm -Dversion=0.6.5-SNAPSHOT -Dpackaging=jar
cd ~/lux/lux-jvm/ && mvn deploy:deploy-file \
-Durl=https://<username>:<password>@oss.sonatype.org/content/repositories/snapshots/ \
diff --git a/lux-jvm/project.clj b/lux-jvm/project.clj
index 803c29b0f..5d9ae53d2 100644
--- a/lux-jvm/project.clj
+++ b/lux-jvm/project.clj
@@ -1,4 +1,4 @@
-(def version "0.6.4")
+(def version "0.6.5-SNAPSHOT")
(def repo "https://github.com/LuxLang/lux")
(def sonatype "https://oss.sonatype.org")
(def sonatype-releases (str sonatype "/service/local/staging/deploy/maven2/"))
@@ -20,6 +20,8 @@
:url ~(str repo ".git")}
:dependencies [[com.github.luxlang/lux-bootstrapper ~version]
+ [com.github.luxlang/lux-jvm-function ~version]
+
;; [com.github.luxlang/stdlib ~version]
;; JVM Bytecode (TODO: Remove ASAP)
[org.ow2.asm/asm "7.3.1"]
diff --git a/lux-jvm/source/luxc/lang/translation/jvm.lux b/lux-jvm/source/luxc/lang/translation/jvm.lux
index 7642a6952..0d4f493bb 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm.lux
@@ -200,4 +200,5 @@
(type.class (..class_name [0 0]) (list)))
(def: .public $Function
- (type.class (..class_name [0 1]) (list)))
+ (type.class "library.lux.Function" ... (..class_name [0 1])
+ (list)))
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux
index 6058ba138..dc2cb5053 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux
@@ -408,11 +408,13 @@
(Operation [Registry Output])
(do phase.monad
[runtime_payload ..translate_runtime
- function_payload ..translate_function]
+ ... function_payload ..translate_function
+ ]
(in [(|> artifact.empty
artifact.resource
product.right
artifact.resource
product.right)
(sequence.sequence runtime_payload
- function_payload)])))
+ ... function_payload
+ )])))
diff --git a/lux-lein/project.clj b/lux-lein/project.clj
index cdd4e8f6e..05e1c9c92 100644
--- a/lux-lein/project.clj
+++ b/lux-lein/project.clj
@@ -1,4 +1,4 @@
-(defproject com.github.luxlang/lein-luxc "0.6.4"
+(defproject com.github.luxlang/lein-luxc "0.6.5-SNAPSHOT"
:description "The Leiningen plugin for the Lux programming language."
:url "https://github.com/LuxLang/lux"
:license {:name "Lux License v0.1.2"
diff --git a/stdlib/commands.md b/stdlib/commands.md
index 8f1ad95e5..a49441d93 100644
--- a/stdlib/commands.md
+++ b/stdlib/commands.md
@@ -40,7 +40,7 @@ cd ~/lux/stdlib/ && mvn deploy:deploy-file \
-Dfile=target/library.tar \
-DgroupId=com.github.luxlang \
-DartifactId=stdlib \
--Dversion=0.6.0-SNAPSHOT \
+-Dversion=0.6.5-SNAPSHOT \
-Dpackaging=tar
cd ~/lux/stdlib/ \
diff --git a/stdlib/project.clj b/stdlib/project.clj
index 850de9fcc..82bdf265e 100644
--- a/stdlib/project.clj
+++ b/stdlib/project.clj
@@ -1,4 +1,4 @@
-(def version "0.6.4")
+(def version "0.6.5-SNAPSHOT")
(def repo "https://github.com/LuxLang/lux")
(def sonatype-releases "https://oss.sonatype.org/service/local/staging/deploy/maven2/")
(def sonatype-snapshots "https://oss.sonatype.org/content/repositories/snapshots/")
diff --git a/stdlib/project.lux b/stdlib/project.lux
index f5b34f7de..1dfe84e5b 100644
--- a/stdlib/project.lux
+++ b/stdlib/project.lux
@@ -2,7 +2,7 @@
[... An optional identity for the project.
... It can also be specified or overriden in a non-default profile.
... This will be the name given to the project when installed/deployed as a dependency.
- "identity" ["com.github.luxlang" "stdlib" "0.6.4"]
+ "identity" ["com.github.luxlang" "stdlib" "0.6.5-SNAPSHOT"]
... Every piece of information, and the whole "info" bundle, are optional.
"info" ["url" "https://github.com/LuxLang/lux"
@@ -41,7 +41,7 @@
... The following are alternative profiles to use in various situations.
"jvm"
[... "compiler" specifies the dependency to fetch and use as the compiler.
- "compiler" ["com.github.luxlang" "lux-jvm" "0.6.4" "jar"]
+ "compiler" ["com.github.luxlang" "lux-jvm" "0.6.5-SNAPSHOT" "jar"]
... "dependencies" is an optional list of dependencies to fetch.
... The dependencies have the same shape as when specifying the compiler.
... When omitting the packaging format of the dependency, "tar" will be assumed.
@@ -70,7 +70,7 @@
]
"ruby"
- ["compiler" ["com.github.luxlang" "lux-ruby" "0.6.4" "jar"]
+ ["compiler" ["com.github.luxlang" "lux-ruby" "0.6.5-SNAPSHOT" "jar"]
... The OS command to use when running Ruby tests. The default is described below.
... "ruby" ["ruby"]
]
diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux
index 9d1fca9af..af39e83e9 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux
@@ -1,51 +1,51 @@
(.using
- [library
- [lux {"-" Module Definition}
- ["[0]" ffi {"+" import: do_to}]
- [abstract
- ["[0]" monad {"+" Monad do}]]
- [control
- ["[0]" maybe ("[1]#[0]" functor)]
- ["[0]" try {"+" Try}]]
- [data
- ["[0]" binary {"+" Binary}]
- ["[0]" text
- ["%" format {"+" format}]]
- [collection
- ["[0]" sequence]
- ["[0]" list ("[1]#[0]" functor)]
- ["[0]" dictionary]
- ["[0]" set {"+" Set}]]]
- [math
- [number
- ["n" nat]
- ["i" int]]]
- [target
- [jvm
- [encoding
- ["[0]" name]]]]
- [world
- ["[0]" file]]]]
- [program
- [compositor
- ["[0]" static {"+" Static}]]]
- ["[0]" // {"+" Packager}
+ [library
+ [lux {"-" Module Definition}
+ ["[0]" ffi {"+" import: do_to}]
+ [abstract
+ ["[0]" monad {"+" Monad do}]]
+ [control
+ ["[0]" maybe ("[1]#[0]" functor)]
+ ["[0]" try {"+" Try}]]
+ [data
+ ["[0]" binary {"+" Binary}]
+ ["[0]" text
+ ["%" format {"+" format}]]
+ [collection
+ ["[0]" sequence]
+ ["[0]" list ("[1]#[0]" functor)]
+ ["[0]" dictionary]
+ ["[0]" set {"+" Set}]]]
+ [math
+ [number
+ ["n" nat]
+ ["i" int]]]
+ [target
+ [jvm
+ [encoding
+ ["[0]" name]]]]
+ [world
+ ["[0]" file]]]]
+ [program
+ [compositor
+ ["[0]" static {"+" Static}]]]
+ ["[0]" // {"+" Packager}
+ [//
+ ["[0]" archive {"+" Output}
+ ["[0]" descriptor {"+" Module}]
+ ["[0]" artifact]]
+ [cache
+ ["[0]" dependency]]
+ ["[0]" io "_"
+ ["[1]" archive]]
[//
- ["[0]" archive {"+" Output}
- ["[0]" descriptor {"+" Module}]
- ["[0]" artifact]]
- [cache
- ["[0]" dependency]]
- ["[0]" io "_"
- ["[1]" archive]]
- [//
- [language
- ["$" lux
- [generation {"+" Context}]
- [phase
- [generation
- [jvm
- ["[0]" runtime {"+" Definition}]]]]]]]]])
+ [language
+ ["$" lux
+ [generation {"+" Context}]
+ [phase
+ [generation
+ [jvm
+ ["[0]" runtime {"+" Definition}]]]]]]]]])
(import: java/lang/Object)