aboutsummaryrefslogtreecommitdiff
path: root/lux-r
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lux-r/source/program.lux182
-rw-r--r--lux-ruby/source/program.lux356
2 files changed, 269 insertions, 269 deletions
diff --git a/lux-r/source/program.lux b/lux-r/source/program.lux
index a9908b445..570a52b4e 100644
--- a/lux-r/source/program.lux
+++ b/lux-r/source/program.lux
@@ -1,72 +1,72 @@
(.using
- [lux "*"
- [program {"+" program:}]
- ["[0]" ffi]
- ["[0]" debug]
- [abstract
- ["[0]" monad {"+" do}]]
- [control
- [pipe {"+" exec> case> new>}]
- ["[0]" maybe]
- ["[0]" try {"+" Try}]
- ["[0]" exception {"+" exception:}]
- ["[0]" io {"+" IO io}]
- [concurrency
- ["[0]" promise {"+" Promise}]]
- [parser
- ["<[0]>" code]]]
- [data
- ["[0]" text ("[1]#[0]" hash)
- ["%" format {"+" format}]
- [encoding
- ["[0]" utf8]]]
- [collection
- ["[0]" array {"+" Array}]]]
- ["[0]" macro
- [syntax {"+" syntax:}]
- ["[0]" template]
- ["[0]" code]]
- [math
- [number {"+" hex}
- ["n" nat]
- ["[0]" i64]]]
- ["[0]" world "_"
- ["[0]" file]
- ["[1]/[0]" program]]
- ["@" target
- ["_" r]]
- [tool
- [compiler
- [phase {"+" Operation Phase}]
- [reference
- [variable {"+" Register}]]
- [language
- [lux
- [program {"+" Program}]
- [generation {"+" Context Host}]
- ["[0]" synthesis]
- [analysis
- [macro {"+" Expander}]]
- [phase
- ["[0]" extension {"+" Extender Handler}
- ["[1]/[0]" bundle]
- ["[0]" analysis "_"
- ["[1]" r]]
- ["[0]" generation "_"
- ["[1]" r]]]
- [generation
- ["[0]" reference]
- ["[0]" r
- ["[0]" runtime]]]]]]
- [default
- ["[0]" platform {"+" Platform}]]
- [meta
- ["[0]" packager "_"
- ["[1]" script]]]]]]
- [program
- ["/" compositor
- ["[1][0]" cli]
- ["[1][0]" static]]])
+ [lux "*"
+ [program {"+" program:}]
+ ["[0]" ffi]
+ ["[0]" debug]
+ [abstract
+ ["[0]" monad {"+" do}]]
+ [control
+ [pipe {"+" exec> case> new>}]
+ ["[0]" maybe]
+ ["[0]" try {"+" Try}]
+ ["[0]" exception {"+" exception:}]
+ ["[0]" io {"+" IO io}]
+ [concurrency
+ ["[0]" promise {"+" Promise}]]
+ [parser
+ ["<[0]>" code]]]
+ [data
+ ["[0]" text ("[1]#[0]" hash)
+ ["%" format {"+" format}]
+ [encoding
+ ["[0]" utf8]]]
+ [collection
+ ["[0]" array {"+" Array}]]]
+ ["[0]" macro
+ [syntax {"+" syntax:}]
+ ["[0]" template]
+ ["[0]" code]]
+ [math
+ [number {"+" hex}
+ ["n" nat]
+ ["[0]" i64]]]
+ ["[0]" world "_"
+ ["[0]" file]
+ ["[1]/[0]" program]]
+ ["@" target
+ ["_" r]]
+ [tool
+ [compiler
+ [phase {"+" Operation Phase}]
+ [reference
+ [variable {"+" Register}]]
+ [language
+ [lux
+ [program {"+" Program}]
+ [generation {"+" Context Host}]
+ ["[0]" synthesis]
+ [analysis
+ [macro {"+" Expander}]]
+ [phase
+ ["[0]" extension {"+" Extender Handler}
+ ["[1]/[0]" bundle]
+ ["[0]" analysis "_"
+ ["[1]" r]]
+ ["[0]" generation "_"
+ ["[1]" r]]]
+ [generation
+ ["[0]" reference]
+ ["[0]" r
+ ["[0]" runtime]]]]]]
+ [default
+ ["[0]" platform {"+" Platform}]]
+ [meta
+ ["[0]" packager "_"
+ ["[1]" script]]]]]]
+ [program
+ ["/" compositor
+ ["[1][0]" cli]
+ ["[1][0]" static]]])
(ffi.import: java/lang/String)
@@ -552,29 +552,29 @@
(Program _.Expression _.Expression)
(_.apply/2 program [(runtime.lux::program_args (_.commandArgs/0 [])) _.null]))
-(for [@.old
- (def: extender
- Extender
- ... TODO: Stop relying on coercions ASAP.
- (<| (:as Extender)
- (function (@self handler))
- (:as Handler)
- (function (@self name phase))
- (:as Phase)
- (function (@self archive parameters))
- (:as Operation)
- (function (@self state))
- (:as Try)
- try.trusted
- (:as Try)
- (exec
- ("lux io log" "TODO: Extender")
- {try.#Failure "TODO: Extender"})))
-
- @.r
- (def: (extender handler)
- Extender
- (:expected handler))])
+(for @.old
+ (def: extender
+ Extender
+ ... TODO: Stop relying on coercions ASAP.
+ (<| (:as Extender)
+ (function (@self handler))
+ (:as Handler)
+ (function (@self name phase))
+ (:as Phase)
+ (function (@self archive parameters))
+ (:as Operation)
+ (function (@self state))
+ (:as Try)
+ try.trusted
+ (:as Try)
+ (exec
+ ("lux io log" "TODO: Extender")
+ {try.#Failure "TODO: Extender"})))
+
+ @.r
+ (def: (extender handler)
+ Extender
+ (:expected handler)))
(def: (declare_success! _)
(-> Any (Promise Any))
diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux
index bd3f1763e..30a276d58 100644
--- a/lux-ruby/source/program.lux
+++ b/lux-ruby/source/program.lux
@@ -759,189 +759,189 @@
[_ (run! content)]
(run! (_.global (reference.artifact context))))))))))
-(for [@.jvm (as_is (exception: .public (invaid_phase_application [partial_application (List Any)
- arity (List Any)])
- (exception.report
- ["Partial Application" (%.nat (list.size partial_application))]
- ["Arity" (%.nat (list.size arity))]))
-
- (def: proc_type
- org/jruby/runtime/Block$Type
- (|> (org/jruby/runtime/Block::NULL_BLOCK)
- (org/jruby/runtime/Block::type)))
-
- (def: phase_block_signature
- org/jruby/runtime/Signature
- (org/jruby/runtime/Signature::THREE_ARGUMENTS))
-
- (def: dummy_static_scope
- org/jruby/parser/StaticScope
- (|> (org/jruby/parser/StaticScopeFactory::new (!ruby_runtime))
- (org/jruby/parser/StaticScopeFactory::getDummyScope)))
-
- (def: phase_block_body
- org/jruby/runtime/BlockBody
- (<| (ffi.:as org/jruby/runtime/BlockBody)
- (ffi.object [] org/jruby/runtime/BlockBody []
- [org/jruby/runtime/Signature ..phase_block_signature]
- ... Methods
- (org/jruby/runtime/BlockBody
- [] (getFile this [])
- java/lang/String
- (ffi.as_string "YOLO"))
-
- (org/jruby/runtime/BlockBody
- [] (getLine this [])
- int
- (ffi.as_int (hex "+ABC,123")))
-
- (org/jruby/runtime/BlockBody
- [] (getStaticScope this [])
- org/jruby/parser/StaticScope
- ..dummy_static_scope)
-
- (org/jruby/runtime/BlockBody
- [] (setStaticScope self [_ org/jruby/parser/StaticScope])
- void
- [])
-
- (org/jruby/runtime/BlockBody
- [] (doYield self [_ org/jruby/runtime/ThreadContext
- _ org/jruby/runtime/Block
- _ org/jruby/runtime/builtin/IRubyObject])
- org/jruby/runtime/builtin/IRubyObject
- (undefined))
-
- (org/jruby/runtime/BlockBody
- [] (doYield self [_ org/jruby/runtime/ThreadContext
- _ org/jruby/runtime/Block
- _ [org/jruby/runtime/builtin/IRubyObject]
- _ org/jruby/runtime/builtin/IRubyObject])
- org/jruby/runtime/builtin/IRubyObject
- (undefined))
- )))
-
- (def: (host_phase partial_application phase)
- (All (_ s i o)
- (-> (List Any) (Phase [extension.Bundle s] i o)
- org/jruby/RubyProc))
- (let [block (ffi.object [] org/jruby/runtime/Block []
- [org/jruby/runtime/BlockBody ..phase_block_body]
- ... Methods
- (org/jruby/runtime/Block
- [] (call this [_thread_context org/jruby/runtime/ThreadContext
- inputs [org/jruby/runtime/builtin/IRubyObject]
- _block org/jruby/runtime/Block])
- org/jruby/runtime/builtin/IRubyObject
- (<| try.trusted
- (do [! try.monad]
- [inputs (|> inputs
- (array.list {.#None})
- (monad.each ! (|>> (ffi.:as java/lang/Object) ..read)))])
- (case inputs
- ... It seems that org/jruby/runtime/Block::call can misbehave when getting called with a Lux state value.
- (^ (list info source location current_module modules scopes type_context expected seed scope_type_vars extensions eval host))
- (case partial_application
- (^ (list partial/0 partial/1))
- (in (..to_host ((:as (-> Any Any Any Any) phase)
- partial/0
- partial/1
- [info source location current_module modules scopes type_context expected seed scope_type_vars extensions eval host])))
-
- _
- (exception.except ..invaid_phase_application [partial_application inputs]))
-
- (^ (list))
- {try.#Success (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject)
- (host_phase partial_application phase))}
-
- (^ (list input/0))
- (case partial_application
- (^ (list))
- (in (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject)
- (host_phase (list input/0) phase)))
-
- (^ (list partial/0))
- (in (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject)
- (host_phase (list partial/0 input/0) phase)))
-
- (^ (list partial/0 partial/1))
- (in (..to_host ((:as (-> Any Any Any Any) phase)
- partial/0
- partial/1
- input/0)))
-
- _
- (exception.except ..invaid_phase_application [partial_application inputs]))
-
- (^ (list input/0 input/1))
- (case partial_application
- (^ (list))
- (in (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject)
- (host_phase (list input/0 input/1) phase)))
-
- (^ (list partial/0))
- (in (..to_host ((:as (-> Any Any Any Any) phase)
- partial/0
- input/0
- input/1)))
-
- _
- (exception.except ..invaid_phase_application [partial_application inputs]))
-
- (^ (list input/0 input/1 input/2))
- (case partial_application
- (^ (list))
- (in (..to_host ((:as (-> Any Any Any Any) phase)
- input/0
- input/1
- input/2)))
-
- _
- (exception.except ..invaid_phase_application [partial_application inputs]))
-
- _
- (exception.except ..invaid_phase_application [partial_application inputs])))))]
- (org/jruby/RubyProc::newProc (!ruby_runtime) block ..proc_type)))
-
- (def: (extender phase_wrapper)
- (-> phase.Wrapper Extender)
- ... TODO: Stop relying on coercions ASAP.
- (<| (:as Extender)
- (function (@self handler))
- (:as Handler)
- (function (@self name phase))
- (:as Phase)
- (function (@self archive parameters))
- (:as Operation)
- (function (@self state))
- (:as Try)
- try.trusted
- (:as Try)
- (do try.monad
- [handler (try.of_maybe (..macro! handler))
- output (org/jruby/RubyProc::call (!ruby_thread_context)
- (|> (ffi.array org/jruby/runtime/builtin/IRubyObject 5)
- (ffi.write! 0 (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject)
- (org/jruby/RubyString::newInternalFromJavaExternal (!ruby_runtime) (ffi.as_string name))))
- (ffi.write! 1 (:as org/jruby/runtime/builtin/IRubyObject (phase_wrapper phase)))
- (ffi.write! 2 (..to_host archive))
- (ffi.write! 3 (..to_host parameters))
- (ffi.write! 4 (..to_host state)))
- handler)]
- (..read (ffi.:as java/lang/Object output))))))
-
- @.ruby
- (def: (extender phase_wrapper handler)
- (-> phase.Wrapper Extender)
- (:expected handler))])
+(for @.jvm (as_is (exception: .public (invaid_phase_application [partial_application (List Any)
+ arity (List Any)])
+ (exception.report
+ ["Partial Application" (%.nat (list.size partial_application))]
+ ["Arity" (%.nat (list.size arity))]))
+
+ (def: proc_type
+ org/jruby/runtime/Block$Type
+ (|> (org/jruby/runtime/Block::NULL_BLOCK)
+ (org/jruby/runtime/Block::type)))
+
+ (def: phase_block_signature
+ org/jruby/runtime/Signature
+ (org/jruby/runtime/Signature::THREE_ARGUMENTS))
+
+ (def: dummy_static_scope
+ org/jruby/parser/StaticScope
+ (|> (org/jruby/parser/StaticScopeFactory::new (!ruby_runtime))
+ (org/jruby/parser/StaticScopeFactory::getDummyScope)))
+
+ (def: phase_block_body
+ org/jruby/runtime/BlockBody
+ (<| (ffi.:as org/jruby/runtime/BlockBody)
+ (ffi.object [] org/jruby/runtime/BlockBody []
+ [org/jruby/runtime/Signature ..phase_block_signature]
+ ... Methods
+ (org/jruby/runtime/BlockBody
+ [] (getFile this [])
+ java/lang/String
+ (ffi.as_string "YOLO"))
+
+ (org/jruby/runtime/BlockBody
+ [] (getLine this [])
+ int
+ (ffi.as_int (hex "+ABC,123")))
+
+ (org/jruby/runtime/BlockBody
+ [] (getStaticScope this [])
+ org/jruby/parser/StaticScope
+ ..dummy_static_scope)
+
+ (org/jruby/runtime/BlockBody
+ [] (setStaticScope self [_ org/jruby/parser/StaticScope])
+ void
+ [])
+
+ (org/jruby/runtime/BlockBody
+ [] (doYield self [_ org/jruby/runtime/ThreadContext
+ _ org/jruby/runtime/Block
+ _ org/jruby/runtime/builtin/IRubyObject])
+ org/jruby/runtime/builtin/IRubyObject
+ (undefined))
+
+ (org/jruby/runtime/BlockBody
+ [] (doYield self [_ org/jruby/runtime/ThreadContext
+ _ org/jruby/runtime/Block
+ _ [org/jruby/runtime/builtin/IRubyObject]
+ _ org/jruby/runtime/builtin/IRubyObject])
+ org/jruby/runtime/builtin/IRubyObject
+ (undefined))
+ )))
+
+ (def: (host_phase partial_application phase)
+ (All (_ s i o)
+ (-> (List Any) (Phase [extension.Bundle s] i o)
+ org/jruby/RubyProc))
+ (let [block (ffi.object [] org/jruby/runtime/Block []
+ [org/jruby/runtime/BlockBody ..phase_block_body]
+ ... Methods
+ (org/jruby/runtime/Block
+ [] (call this [_thread_context org/jruby/runtime/ThreadContext
+ inputs [org/jruby/runtime/builtin/IRubyObject]
+ _block org/jruby/runtime/Block])
+ org/jruby/runtime/builtin/IRubyObject
+ (<| try.trusted
+ (do [! try.monad]
+ [inputs (|> inputs
+ (array.list {.#None})
+ (monad.each ! (|>> (ffi.:as java/lang/Object) ..read)))])
+ (case inputs
+ ... It seems that org/jruby/runtime/Block::call can misbehave when getting called with a Lux state value.
+ (^ (list info source location current_module modules scopes type_context expected seed scope_type_vars extensions eval host))
+ (case partial_application
+ (^ (list partial/0 partial/1))
+ (in (..to_host ((:as (-> Any Any Any Any) phase)
+ partial/0
+ partial/1
+ [info source location current_module modules scopes type_context expected seed scope_type_vars extensions eval host])))
+
+ _
+ (exception.except ..invaid_phase_application [partial_application inputs]))
+
+ (^ (list))
+ {try.#Success (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject)
+ (host_phase partial_application phase))}
+
+ (^ (list input/0))
+ (case partial_application
+ (^ (list))
+ (in (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject)
+ (host_phase (list input/0) phase)))
+
+ (^ (list partial/0))
+ (in (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject)
+ (host_phase (list partial/0 input/0) phase)))
+
+ (^ (list partial/0 partial/1))
+ (in (..to_host ((:as (-> Any Any Any Any) phase)
+ partial/0
+ partial/1
+ input/0)))
+
+ _
+ (exception.except ..invaid_phase_application [partial_application inputs]))
+
+ (^ (list input/0 input/1))
+ (case partial_application
+ (^ (list))
+ (in (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject)
+ (host_phase (list input/0 input/1) phase)))
+
+ (^ (list partial/0))
+ (in (..to_host ((:as (-> Any Any Any Any) phase)
+ partial/0
+ input/0
+ input/1)))
+
+ _
+ (exception.except ..invaid_phase_application [partial_application inputs]))
+
+ (^ (list input/0 input/1 input/2))
+ (case partial_application
+ (^ (list))
+ (in (..to_host ((:as (-> Any Any Any Any) phase)
+ input/0
+ input/1
+ input/2)))
+
+ _
+ (exception.except ..invaid_phase_application [partial_application inputs]))
+
+ _
+ (exception.except ..invaid_phase_application [partial_application inputs])))))]
+ (org/jruby/RubyProc::newProc (!ruby_runtime) block ..proc_type)))
+
+ (def: (extender phase_wrapper)
+ (-> phase.Wrapper Extender)
+ ... TODO: Stop relying on coercions ASAP.
+ (<| (:as Extender)
+ (function (@self handler))
+ (:as Handler)
+ (function (@self name phase))
+ (:as Phase)
+ (function (@self archive parameters))
+ (:as Operation)
+ (function (@self state))
+ (:as Try)
+ try.trusted
+ (:as Try)
+ (do try.monad
+ [handler (try.of_maybe (..macro! handler))
+ output (org/jruby/RubyProc::call (!ruby_thread_context)
+ (|> (ffi.array org/jruby/runtime/builtin/IRubyObject 5)
+ (ffi.write! 0 (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject)
+ (org/jruby/RubyString::newInternalFromJavaExternal (!ruby_runtime) (ffi.as_string name))))
+ (ffi.write! 1 (:as org/jruby/runtime/builtin/IRubyObject (phase_wrapper phase)))
+ (ffi.write! 2 (..to_host archive))
+ (ffi.write! 3 (..to_host parameters))
+ (ffi.write! 4 (..to_host state)))
+ handler)]
+ (..read (ffi.:as java/lang/Object output))))))
+
+ @.ruby
+ (def: (extender phase_wrapper handler)
+ (-> phase.Wrapper Extender)
+ (:expected handler)))
(def: (phase_wrapper archive)
(-> Archive (runtime.Operation phase.Wrapper))
(<| phase#in
(:as phase.Wrapper)
- (for [@.jvm (..host_phase (list))
- @.ruby (|>>)])))
+ (for @.jvm (..host_phase (list))
+ @.ruby (|>>))))
(def: platform
(IO (Platform Register _.Expression _.Statement))