diff options
| author | CircleShift <kgunger12@gmail.com> | 2025-12-09 02:25:30 -0500 |
|---|---|---|
| committer | CircleShift <kgunger12@gmail.com> | 2025-12-09 02:25:30 -0500 |
| commit | 0587f854d80a9ad95c459b45509fcda7926cde20 (patch) | |
| tree | 2b3e0d2f2cbfa541bb4d9bf2e2c7f5af5bcaafdc /tnslc/compile/function.tnsl | |
| parent | de71ecd4d3f52deb6f854540f42f931b2e55055c (diff) | |
begin on the actual codegenorigin
Diffstat (limited to 'tnslc/compile/function.tnsl')
| -rw-r--r-- | tnslc/compile/function.tnsl | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/tnslc/compile/function.tnsl b/tnslc/compile/function.tnsl index d55579e..eec65ed 100644 --- a/tnslc/compile/function.tnsl +++ b/tnslc/compile/function.tnsl @@ -161,7 +161,35 @@ struct Function { self._end_func(~fscope, cb) ;/ - /; _compile_statements(~Scope s, int off) + # + # Compiling individual statements + # + + /; _compile_statements (~Scope s, int off) + ~parse.Node _up = self._up + ~parse.Node n = NULL + /; loop (off < _up`.sub.count) [off++] + n = _up`.sub.get(off) + /; if (n`._type == parse.NTYPE_FLOW_CONTROL) + self._compile_flow_control(s, n) + ;; else if (n`._type == parse.NTYPE_ASM) + s`.cb`.add_c(" \0") + s`.cb`.add_c(n`.data) + s`.cb`.add_c(" ; User defined asm\n\0") + ;/ + ;/ + ;/ + + # Should handle break, continue, and return + /; _compile_flow_control (~Scope s, ~parse.Node n) + /; if (utils.strcmp(n`.data, "return\0") == true) + # Compute value and return + self._compile_value(s, n) + ;/ + ;/ + + # Should handle computing a value, delegate to other funcs when needed + /; _compile_value (~Scope s, ~parse.Node n) ;/ /; _print (int idt) |