Skip to content

Commit

Permalink
Better syntax for templating.
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoejp committed Jul 18, 2024
1 parent 893ba40 commit 58f497c
Show file tree
Hide file tree
Showing 541 changed files with 12,912 additions and 13,584 deletions.
16 changes: 8 additions & 8 deletions lux-c++/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,16 @@
(getattr [@ (template.name [/runtime._] [<short>])]))]
(on it)))]

[object_tag Natural]
[lux_bit Bit]
[lux_i64 Integer]
[lux_text Text]
[[object_tag Natural]
[lux_bit Bit]
[lux_i64 Integer]
[lux_text Text]

[variant::lefts Natural]
[variant::right? Bit]
[variant::choice Value]
[variant::lefts Natural]
[variant::right? Bit]
[variant::choice Value]

[tuple::arity Natural]
[tuple::arity Natural]]
)

(the (lux_variant lefts right? choice)
Expand Down
39 changes: 21 additions & 18 deletions lux-cl/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@
(list ["Class" (java/lang/Object::toString (java/lang/Object::getClass object))]
["Object" (java/lang/Object::toString object)])))]

[unknown_kind_of_object]
[cannot_apply_a_non_function]
[[unknown_kind_of_object]
[cannot_apply_a_non_function]]
)

(the host_bit
Expand All @@ -187,12 +187,12 @@

{.#None})]

[[java/lang/Object] [host_value]]
[java/lang/Boolean [..host_bit]]
[java/lang/Integer [java/lang/Integer::longValue org/armedbear/lisp/Fixnum::getInstance]]
[java/lang/Long [org/armedbear/lisp/Bignum::getInstance]]
[java/lang/Double [org/armedbear/lisp/DoubleFloat::new]]
[java/lang/String [org/armedbear/lisp/SimpleString::new]]
[[[java/lang/Object] [host_value]]
[java/lang/Boolean [..host_bit]]
[java/lang/Integer [java/lang/Integer::longValue org/armedbear/lisp/Fixnum::getInstance]]
[java/lang/Long [org/armedbear/lisp/Bignum::getInstance]]
[java/lang/Double [org/armedbear/lisp/DoubleFloat::new]]
[java/lang/String [org/armedbear/lisp/SimpleString::new]]]
))
... else
(as org/armedbear/lisp/LispObject sub_value))))))]
Expand Down Expand Up @@ -224,7 +224,9 @@
{.#None}
(org/armedbear/lisp/Nil::NIL)))]

[NTH] [SVREF] [elt]
[[NTH]
[SVREF]
[elt]]
))
))))

Expand Down Expand Up @@ -272,15 +274,16 @@

{.#None})]

[org/armedbear/lisp/Bignum [org/armedbear/lisp/Bignum::longValue {try.#Success}]]
[org/armedbear/lisp/Fixnum [org/armedbear/lisp/Fixnum::longValue {try.#Success}]]
[org/armedbear/lisp/DoubleFloat [org/armedbear/lisp/DoubleFloat::doubleValue {try.#Success}]]
[org/armedbear/lisp/SimpleString [org/armedbear/lisp/SimpleString::getStringValue {try.#Success}]]
[org/armedbear/lisp/Cons [(read_variant read)]]
[org/armedbear/lisp/SimpleVector [(read_tuple read)]]
[org/armedbear/lisp/Nil [(pipe.new {try.#Success false} [])]]
[org/armedbear/lisp/Closure [{try.#Success}]]
[program/LuxADT [program/LuxADT::getValue {try.#Success}]]))
[[org/armedbear/lisp/Bignum [org/armedbear/lisp/Bignum::longValue {try.#Success}]]
[org/armedbear/lisp/Fixnum [org/armedbear/lisp/Fixnum::longValue {try.#Success}]]
[org/armedbear/lisp/DoubleFloat [org/armedbear/lisp/DoubleFloat::doubleValue {try.#Success}]]
[org/armedbear/lisp/SimpleString [org/armedbear/lisp/SimpleString::getStringValue {try.#Success}]]
[org/armedbear/lisp/Cons [(read_variant read)]]
[org/armedbear/lisp/SimpleVector [(read_tuple read)]]
[org/armedbear/lisp/Nil [(pipe.new {try.#Success false} [])]]
[org/armedbear/lisp/Closure [{try.#Success}]]
[program/LuxADT [program/LuxADT::getValue {try.#Success}]]]
))
(when (ffi.is org/armedbear/lisp/Symbol host_object)
{.#Some host_object}
(if (same? (org/armedbear/lisp/Symbol::T) host_object)
Expand Down
15 changes: 9 additions & 6 deletions lux-js/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@
"[1]::[0]"
(getValue [] java/lang/Object))]

[IntegerValue]
[StructureValue]
[[IntegerValue]
[StructureValue]]
)

(exception.the (unknown_member [member object])
Expand Down Expand Up @@ -437,17 +437,20 @@

{.#None})]

[java/lang/Boolean] [java/lang/String]))
[[java/lang/Boolean]
[java/lang/String]]
))
(,, (template.with [<class> <method>]
[(when (ffi.as <class> js_object)
{.#Some js_object}
{try.#Success (|> js_object <method>)}

{.#None})]

[java/lang/Number (java/lang/Number::doubleValue [])]
[StructureValue (StructureValue::getValue [])]
[IntegerValue (IntegerValue::getValue [])]))
[[java/lang/Number (java/lang/Number::doubleValue [])]
[StructureValue (StructureValue::getValue [])]
[IntegerValue (IntegerValue::getValue [])]]
))
(when (ffi.as org/openjdk/nashorn/api/scripting/ScriptObjectMirror js_object)
{.#Some js_object}
(when (check_integer js_object)
Expand Down
38 changes: 19 additions & 19 deletions lux-lua/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,13 @@

_)]

[LuxValue (<| {try.#Success} (LuxValue::getValue []))]
[java/lang/Boolean {try.#Success}]
[java/lang/Long {try.#Success}]
[java/lang/Double {try.#Success}]
[java/lang/String {try.#Success}]
[net/sandius/rembulan/ByteString (<| {try.#Success} (net/sandius/rembulan/ByteString::decode []))]
[net/sandius/rembulan/runtime/LuaFunction {try.#Success}]
[[LuxValue (<| {try.#Success} (LuxValue::getValue []))]
[java/lang/Boolean {try.#Success}]
[java/lang/Long {try.#Success}]
[java/lang/Double {try.#Success}]
[java/lang/String {try.#Success}]
[net/sandius/rembulan/ByteString (<| {try.#Success} (net/sandius/rembulan/ByteString::decode []))]
[net/sandius/rembulan/runtime/LuaFunction {try.#Success}]]
))
(when (ffi.as net/sandius/rembulan/impl/DefaultTable host_object)
{.#Some typed_object}
Expand Down Expand Up @@ -304,11 +304,11 @@
lux_function)
(,, (static.literals function.identity (..input/* <arity>))))))]

[1]
[2]
[3]
[4]
[5]
[[1]
[2]
[3]
[4]
[5]]
))

[(list (,, (static.literals function.identity (..input/* 5)))) input/+]
Expand Down Expand Up @@ -349,11 +349,11 @@
(list (,, (static.literals function.identity (..input/* <arity>))))
lux_function)))]

[1]
[2]
[3]
[4]
[5]
[[1]
[2]
[3]
[4]
[5]]
))

(net/sandius/rembulan/runtime/LuaFunction
Expand Down Expand Up @@ -796,8 +796,8 @@

{.#None})]

[[java/lang/Object] (..lux_structure to_host)]
[library/lux/Function (..lua_function to_host)]
[[[java/lang/Object] (..lux_structure to_host)]
[library/lux/Function (..lua_function to_host)]]
))
(as (-> Any java/lang/Object) it))))

Expand Down
36 changes: 18 additions & 18 deletions lux-php/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
"[1]::[0]"
(getValue [] java/lang/Object)))]

[StructureValue]
[[StructureValue]]
)

(every Reader
Expand Down Expand Up @@ -258,15 +258,15 @@

{.#None})]

[php/runtime/memory/ReferenceMemory
php/runtime/Memory::generic_valueOfIndex
php/runtime/memory/ReferenceMemory::getValue]
[php/runtime/memory/LongMemory
php/runtime/Memory::long_valueOfIndex
php/runtime/memory/LongMemory::toLong]
[php/runtime/memory/StringMemory
php/runtime/Memory::string_valueOfIndex
php/runtime/memory/StringMemory::toString]
[[php/runtime/memory/ReferenceMemory
php/runtime/Memory::generic_valueOfIndex
php/runtime/memory/ReferenceMemory::getValue]
[php/runtime/memory/LongMemory
php/runtime/Memory::long_valueOfIndex
php/runtime/memory/LongMemory::toLong]
[php/runtime/memory/StringMemory
php/runtime/Memory::string_valueOfIndex
php/runtime/memory/StringMemory::toString]]
))
(undefined))))

Expand Down Expand Up @@ -391,8 +391,8 @@

{.#None})]

[php/runtime/memory/FalseMemory false]
[php/runtime/memory/TrueMemory true]
[[php/runtime/memory/FalseMemory false]
[php/runtime/memory/TrueMemory true]]
))
(,, (template.with [<class> <post>]
[(when (ffi.as <class> host_object)
Expand All @@ -401,12 +401,12 @@

{.#None})]

[program/StructureValue [program/StructureValue::getValue {try.#Success}]]
[php/runtime/memory/LongMemory [php/runtime/memory/LongMemory::toLong {try.#Success}]]
[php/runtime/memory/DoubleMemory [php/runtime/memory/DoubleMemory::toDouble {try.#Success}]]
[php/runtime/memory/StringMemory [php/runtime/memory/StringMemory::toString {try.#Success}]]
[php/runtime/memory/ReferenceMemory [php/runtime/memory/ReferenceMemory::getValue read]]
[php/runtime/memory/ObjectMemory [{try.#Success}]]
[[program/StructureValue [program/StructureValue::getValue {try.#Success}]]
[php/runtime/memory/LongMemory [php/runtime/memory/LongMemory::toLong {try.#Success}]]
[php/runtime/memory/DoubleMemory [php/runtime/memory/DoubleMemory::toDouble {try.#Success}]]
[php/runtime/memory/StringMemory [php/runtime/memory/StringMemory::toString {try.#Success}]]
[php/runtime/memory/ReferenceMemory [php/runtime/memory/ReferenceMemory::getValue read]]
[php/runtime/memory/ObjectMemory [{try.#Success}]]]
))
(when (ffi.as php/runtime/memory/ArrayMemory host_object)
{.#Some value}
Expand Down
61 changes: 31 additions & 30 deletions lux-python/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -223,20 +223,20 @@

_)]

[LuxValue [(LuxValue::value [])]]
[org/python/core/PyNone [(pipe.new [] [])]]
[org/python/core/PyBoolean [(org/python/core/PyObject::__nonzero__ [])]]
... [org/python/core/PyInteger [(ffi.is org/python/core/PyObject) org/python/core/PyObject::asInt]]
[org/python/core/PyInteger [(ffi.is org/python/core/PyObject)
(.jvm_member_invoke_virtual# [] "org.python.core.PyObject" "asInt" [])
.jvm_object_cast#
(is (Nominal "java.lang.Integer"))]]
[org/python/core/PyLong [(org/python/core/PyObject::asLong [])]]
[org/python/core/PyFloat [(org/python/core/PyObject::asDouble [])]]
[org/python/core/PyString [(org/python/core/PyObject::asString [])]]
[org/python/core/PyFunction []]
[org/python/core/PyArray [(org/python/core/PyArray::getArray [])]]
[[java/lang/Object] [(|>)]]
[[LuxValue [(LuxValue::value [])]]
[org/python/core/PyNone [(pipe.new [] [])]]
[org/python/core/PyBoolean [(org/python/core/PyObject::__nonzero__ [])]]
... [org/python/core/PyInteger [(ffi.is org/python/core/PyObject) org/python/core/PyObject::asInt]]
[org/python/core/PyInteger [(ffi.is org/python/core/PyObject)
(.jvm_member_invoke_virtual# [] "org.python.core.PyObject" "asInt" [])
.jvm_object_cast#
(is (Nominal "java.lang.Integer"))]]
[org/python/core/PyLong [(org/python/core/PyObject::asLong [])]]
[org/python/core/PyFloat [(org/python/core/PyObject::asDouble [])]]
[org/python/core/PyString [(org/python/core/PyObject::asString [])]]
[org/python/core/PyFunction []]
[org/python/core/PyArray [(org/python/core/PyArray::getArray [])]]
[[java/lang/Object] [(|>)]]]
))
(,, (template.with [<class> <processing>]
[(when (ffi.as <class> host_object)
Expand All @@ -245,8 +245,8 @@

_)]

[org/python/core/PyTuple (..read_variant read)]
[org/python/core/PyList (..read_tuple read)]
[[org/python/core/PyTuple (..read_variant read)]
[org/python/core/PyList (..read_tuple read)]]
))
... (exception.except ..unknown_kind_of_object [(as (-> Any java/lang/Object) host_object)])
{try.#Success host_object})))
Expand Down Expand Up @@ -287,14 +287,15 @@
it)
(,, (static.literals code.local (inputs/? <arity>)))))]

[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]))
[[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]]
))

[(list (,, (static.literals code.local (inputs/? 8))))
input/+]
Expand Down Expand Up @@ -358,12 +359,12 @@

{.#None})]

[java/lang/Boolean org/python/core/PyBoolean::new]
[java/lang/Long org/python/core/PyLong::new]
[java/lang/Double org/python/core/PyFloat::new]
[java/lang/String org/python/core/PyString::new]
[library/lux/Function (pseudo_function to_host)]
[[java/lang/Object] (to_host|array to_host)]
[[java/lang/Boolean org/python/core/PyBoolean::new]
[java/lang/Long org/python/core/PyLong::new]
[java/lang/Double org/python/core/PyFloat::new]
[java/lang/String org/python/core/PyString::new]
[library/lux/Function (pseudo_function to_host)]
[[java/lang/Object] (to_host|array to_host)]]
))
(as (-> Any org/python/core/PyObject)
it))))
Expand Down
Loading

0 comments on commit 58f497c

Please sign in to comment.