summaryrefslogtreecommitdiff
path: root/tnslc/compile/function.tnsl
diff options
context:
space:
mode:
authorCircleShift <kgunger12@gmail.com>2025-03-05 07:26:58 -0500
committerCircleShift <kgunger12@gmail.com>2025-03-05 07:26:58 -0500
commitd4fe9e6e27f2013a6e1f6be94daba91ec53fa5c3 (patch)
treebc30806a177f62c15e991d9ebcd5d2034a786183 /tnslc/compile/function.tnsl
parent61e1e5ce377719c8e9e437e5ba79ba06fc1de4ba (diff)
[tnslc] Rework compile layout
Diffstat (limited to 'tnslc/compile/function.tnsl')
-rw-r--r--tnslc/compile/function.tnsl36
1 files changed, 36 insertions, 0 deletions
diff --git a/tnslc/compile/function.tnsl b/tnslc/compile/function.tnsl
new file mode 100644
index 0000000..cf42db1
--- /dev/null
+++ b/tnslc/compile/function.tnsl
@@ -0,0 +1,36 @@
+
+struct Function {
+ ~uint8 name,
+ utils.Vector
+ inputs,
+ outputs,
+ ~parse.Node body
+}
+
+/; method Function
+ /; init (~uint8 name)
+ self.name = name
+ Var v
+ self.inputs.init(len v)
+ self.outputs.init(len v)
+ ;/
+
+ /; end
+ _delete(self.name)
+ self.body`.end()
+
+ ~Var v
+ /; loop (int i = 0; i < self.inputs.count) [i++]
+ v = self.inputs.get(i)
+ v`.end()
+ ;/
+ self.inputs.end()
+
+ /; loop (int i = 0; i < self.outputs.count) [i++]
+ v = self.outputs.get(i)
+ v`.end()
+ ;/
+ self.outputs.end()
+ ;/
+;/
+