summaryrefslogtreecommitdiff
path: root/tnslc/compile/var.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/var.tnsl
parent61e1e5ce377719c8e9e437e5ba79ba06fc1de4ba (diff)
[tnslc] Rework compile layout
Diffstat (limited to 'tnslc/compile/var.tnsl')
-rw-r--r--tnslc/compile/var.tnsl33
1 files changed, 33 insertions, 0 deletions
diff --git a/tnslc/compile/var.tnsl b/tnslc/compile/var.tnsl
new file mode 100644
index 0000000..9526fc6
--- /dev/null
+++ b/tnslc/compile/var.tnsl
@@ -0,0 +1,33 @@
+
+struct Var {
+ ~uint8 name,
+ ~Struct _type,
+ utils.Vector ptrc,
+ int loc
+}
+
+/; method Var
+ /; init (~uint8 name)
+ self.name = name
+ self.ptrc.init(4)
+ ;/
+
+ /; ptr [int32]
+ ~int32 i
+ i = self.ptrc.get(self.ptrc.count - 1)
+ return i`
+ ;/
+
+ /; ptr_push (int32 p)
+ self.ptrc.push(~p)
+ ;/
+
+ /; ptr_pop
+ self.ptrc.pop()
+ ;/
+
+ /; end
+ _delete(self.name)
+ self.ptrc.end()
+ ;/
+;/