aboutsummaryrefslogtreecommitdiff
path: root/lux-c++/source/program.lux
diff options
context:
space:
mode:
Diffstat (limited to 'lux-c++/source/program.lux')
-rw-r--r--lux-c++/source/program.lux72
1 files changed, 34 insertions, 38 deletions
diff --git a/lux-c++/source/program.lux b/lux-c++/source/program.lux
index 4d669f5d5..9f7721aed 100644
--- a/lux-c++/source/program.lux
+++ b/lux-c++/source/program.lux
@@ -51,17 +51,18 @@
[macro (.only Expander)]]
["[0]" phase (.only Operation Phase)
["[0]" extension (.only Extender Handler)
- ["[0]" analysis
- ["[1]" js]]
- ["[0]" translation
- ["[1]" js]]]
+ ... ["[0]" analysis
+ ... ["[1]" js]]
+ ... ["[0]" translation
+ ... ["[1]" js]]
+ ]
[translation
["[0]" reference]
- ["[0]" c++ (.only)
- ["[0]" runtime]
- ["[0]" type]
- ["[0]" primitive]
- ["[0]" complex]]]]]]
+ ["/" c++ (.only)
+ ["[1][0]" runtime]
+ ["[1][0]" type]
+ ["[1][0]" primitive]
+ ["[1][0]" reference]]]]]]
[default
["[0]" platform (.only Platform)]]
[meta
@@ -95,7 +96,7 @@
... (program []
... (do io.monad
... [? (cppyy::cppdef [(_.code (all _.then
-... runtime.declaration
+... /runtime.declaration
... (_.include "iostream")
... (_.function (_.local <say_hello>)
@@ -103,10 +104,10 @@
... (list)
... :.void
... (all _.then
-... (print (_.deref (runtime.host_value type.bit (runtime.simple type.bit (primitive.bit true)))))
-... (print (_.deref (runtime.host_value type.i64 (runtime.simple type.i64 (primitive.i64 +123)))))
-... (print (_.deref (runtime.host_value type.f64 (runtime.simple type.f64 (primitive.f64 -456.789)))))
-... ... (print (_.deref (runtime.host_value type.text (runtime.simple type.text (primitive.text "YOLO")))))
+... (print (_.deref (/runtime.host_value /type.bit (/runtime.simple /type.bit (/primitive.bit true)))))
+... (print (_.deref (/runtime.host_value /type.i64 (/runtime.simple /type.i64 (/primitive.i64 +123)))))
+... (print (_.deref (/runtime.host_value /type.f64 (/runtime.simple /type.f64 (/primitive.f64 -456.789)))))
+... ... (print (_.deref (/runtime.host_value /type.text (/runtime.simple /type.text (/primitive.text "YOLO")))))
... ))))])
... .let [_ (debug.log! (%.format "BEFORE " (%.bit ?)))]
... global (cppyy::gbl)
@@ -119,22 +120,22 @@
(ffi.import (getattr [(ffi.Object Any) Text] Any))
(def host
- (IO (Host runtime.Value runtime.Declaration))
+ (IO (Host /runtime.Value /runtime.Declaration))
(io (let [\n\t (%.format text.\n text.\t)
- evaluate! (is (-> unit.ID [(Maybe unit.ID) runtime.Value] (Try Any))
+ evaluate! (is (-> unit.ID [(Maybe unit.ID) /runtime.Value] (Try Any))
(function (evaluate! context [_ input])
(let [global (reference.artifact context)
- definition (_.constant (_.local global) type.value input)]
+ definition (_.constant (_.local global) /type.value input)]
(if (io.run! (cppyy::cppdef (_.code definition)))
{try.#Success (getattr (io.run! (cppyy::gbl)) global)}
{try.#Failure "Cannot evaluate!"}))))
- execute! (is (-> runtime.Declaration
+ execute! (is (-> /runtime.Declaration
(Try Any))
(function (execute! input)
(if (io.run! (cppyy::cppdef (_.code input)))
{try.#Success []}
{try.#Failure "Cannot execute!"})))]
- (is (Host runtime.Value runtime.Declaration)
+ (is (Host /runtime.Value /runtime.Declaration)
(implementation
(def evaluate evaluate!)
(def execute execute!)
@@ -143,16 +144,16 @@
custom)
@global (_.local global)]
(do try.monad
- [.let [definition (_.constant @global type.value input)]
+ [.let [definition (_.constant @global /type.value input)]
_ (execute! definition)
- value (evaluate! context [@def @global])]
+ .let [value (getattr (io.run! (cppyy::gbl)) global)]]
(in [global value definition]))))
(def (ingest context content)
(|> content
(of utf8.codec decoded)
try.trusted
- (as runtime.Declaration)))
+ (as /runtime.Declaration)))
(def (re_learn context custom content)
(execute! content))
@@ -162,21 +163,21 @@
[_ (execute! content)]
(evaluate! context [{.#None} (_.local (reference.artifact context))]))))))))
-(def (phase_wrapper _)
+(def phase_wrapper
phase.Wrapper
- (undefined))
+ (|>>))
(def .public platform
- (IO [runtime.Host
- (Platform runtime.Anchor runtime.Value runtime.Declaration)])
+ (IO [/runtime.Host
+ (Platform /runtime.Anchor /runtime.Value /runtime.Declaration)])
(do io.monad
[host ..host]
(in [host
[platform.#file_system (file.async file.default)
platform.#host host
- platform.#phase c++.translation
- platform.#runtime runtime.translation
+ platform.#phase /.translation
+ platform.#runtime /runtime.translation
platform.#phase_wrapper ..phase_wrapper
platform.#write (|>> _.code (of utf8.codec encoded))]])))
@@ -185,22 +186,17 @@
Extender
(undefined))
-(def reference_system
- (reference.System runtime.Value)
- (implementation
- (def constant' _.local)
- (def variable' _.local)))
-
(def (expander macro inputs lux)
Expander
(undefined))
(def (c++_program name it)
- (Program runtime.Value runtime.Declaration)
+ (Program /runtime.Value /runtime.Declaration)
(undefined))
(def (declare_success! _)
- (-> Any (Async Any))
+ (-> Any
+ (Async Any))
(async.future (of environment.default exit +0)))
(def _
@@ -217,10 +213,10 @@
extension.empty
extension.empty
..c++_program
- (reference.constant reference_system)
+ /reference.constant
..extender
service
- [(packager.package (is runtime.Declaration (_.manual ""))
+ [(packager.package (is /runtime.Declaration (_.manual ""))
_.code
_.also
(_.namespace "lux_program"))