summaryrefslogtreecommitdiff
path: root/tnslc/'
diff options
context:
space:
mode:
authorCircleShift <kgunger12@gmail.com>2025-12-03 02:34:37 -0500
committerCircleShift <kgunger12@gmail.com>2025-12-03 02:34:37 -0500
commit1c2cd72c064fffa340405e77d543c58b4aed8b24 (patch)
tree9e4f45e6152770f191e697451e6467e2ad1e8aa7 /tnslc/'
parentb9032fd845e9425df4f0bdf93701edf503c14534 (diff)
[tnslc] remove random file
Diffstat (limited to 'tnslc/'')
-rw-r--r--tnslc/'165
1 files changed, 0 insertions, 165 deletions
diff --git a/tnslc/' b/tnslc/'
deleted file mode 100644
index 485e5d1..0000000
--- a/tnslc/'
+++ /dev/null
@@ -1,165 +0,0 @@
-
-struct Function {
- ~uint8 name,
- utils.Vector
- inputs,
- outputs,
- ~parse.Node _up,
-}
-
-/; method Function
- /; init (~parse.Node n)
- self.name = utils.strcpy(n`.data)
- self._up = n
- Var v
- self.inputs.init(len v)
- self.outputs.init(len v)
- ;/
-
- /; _resolve_dlist (~Module parent, ~parse.Node dl)
- ~parse.Node tn = NULL
- ~parse.Node n
- /; loop (int i = 0; i < dl`.sub.count) [i++]
- n = dl`.sub.get(i)
- /; if (n`._type == parse.NTYPE_TYPE)
- tn = n
- ;; else if (n`._type == parse.NTYPE_ID)
- /; if (tn == NULL)
- _printf("Identifier declared in parameter list before any type was found!\n\0")
- return
- ;/
- Var p
- p.init(tn, n)
- p._resolve_type(parent)
- self.inputs.push(~p)
- ;/
- ;/
- ;/
-
- /; _resolve_tlist (~Module parent, ~parse.Node tl)
- ~parse.Node n
- parse.Node dummy
- dummy.data = "### OUTPUT ###\0"
- /; loop (int i = 0; i < tl`.sub.count) [i++]
- n = tl`.sub.get(i)
- /; if (n`._type == parse.NTYPE_TYPE)
- Var r
- r.init(n, ~dummy)
- r._resolve_type(parent)
- self.outputs.push(~r)
- ;/
- ;/
- ;/
-
- /; _resolve_type (~Module parent)
- ~parse.Node _up = self._up
- /; if (_up`.sub.count < 1)
- return
- ;/
-
- ~parse.Node lst = _up`.sub.get(0)
- /; if (lst`._type == parse.NTYPE_DLIST)
- self._resolve_dlist(parent, lst)
- /; if (_up`.sub.count > 1)
- lst = _up`.sub.get(1)
- ;/
- ;/
-
- /; if (lst`._type == parse.NTYPE_TLIST)
- self._resolve_tlist(parent, lst)
- ;/
- ;/
-
- /; _fqn (~Module parent) [~uint8]
- utils.Vector out
-
- return out.as_cstr()
- ;/
-
- /; _build_scope(~Module parent, ~CompBuf cb) [Scope]
- ~uint8 fqn = self._fqn(parent)
- Scope out
- out.init(parent, cb, fqn)
- _delete(fqn)
-
- # TODO: Push all saved vars and deal with parameters
- # TODO: Add all params to the scope
-
- return out
- ;/
-
- /; _end_scope(~Scope scope, ~CompBuf cb)
- ;/
-
- /; _compile (~Module parent, ~CompBuf cb)
- # Sanity check
- ~parse.Node _up = self._up
- /; if (_up`.sub.count < 1)
- ~Scope s = self._build_scope(parent, cb)
- self._end_scope(s, cb)
- return
- ;/
-
- # Skip past parameters and outputs
- int i = 0
- ~parse.Node n = _up`.sub.get(i)
- /; if (n`._type == parse.NTYPE_DLIST)
- i++
- /; if (_up`.sub.count > 1)
- n = _up`.sub.get(1)
- ;/
- ;/
-
- /; if (n`._type == parse.NTYPE_TLIST)
- i++
- ;/
-
- # Create scope and start compiling statements from here.
- Scope fscope = self._build_scope(parent, cb)
- fscope._compile_statements(cb, _up, i)
- self._end_scope(~fscope, cb)
- ;/
-
- /; _print (int idt)
- _indent(idt)
- _printf("{ Function : \0")
- _printf(self.name)
- _printf("\n\0")
-
- _indent(idt)
- _printf(" inputs:\n\0")
- ~Var prtv
- /; loop (int i = 0; i < self.inputs.count) [i++]
- prtv = self.inputs.get(i)
- prtv`._print(idt + 1)
- ;/
-
- _indent(idt)
- _printf(" outputs:\n\0")
- /; loop (int i = 0; i < self.outputs.count) [i++]
- prtv = self.outputs.get(i)
- prtv`._print(idt + 1)
- ;/
-
- _indent(idt)
- _printf("}\n\0")
- ;/
-
- /; end
- _delete(self.name)
-
- ~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()
- ;/
-;/
-