summaryrefslogtreecommitdiff
path: root/tnslc/compile/compile.tnsl
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2022-12-23 03:33:56 -0500
committerKyle Gunger <kgunger12@gmail.com>2022-12-23 03:33:56 -0500
commit3b0ad0c84111be433de39b8a74c03db7e99cb686 (patch)
treeb7f7149953d1523a5824b0c04e4d31591e2bc0bd /tnslc/compile/compile.tnsl
parent2ec32dac56b544bc4851a3efddf75ee5fd9314ed (diff)
Add initial value functions
Diffstat (limited to 'tnslc/compile/compile.tnsl')
-rw-r--r--tnslc/compile/compile.tnsl49
1 files changed, 31 insertions, 18 deletions
diff --git a/tnslc/compile/compile.tnsl b/tnslc/compile/compile.tnsl
index b8c6cd3..b7bdb3e 100644
--- a/tnslc/compile/compile.tnsl
+++ b/tnslc/compile/compile.tnsl
@@ -69,12 +69,9 @@
;struct VTrack {
{}{}uint8
sym_names,
-
- {}bool
- on_stack,
- {}VType
- sym_types
+ {}Value
+ sym_vals
}
/; method VTrack
@@ -88,20 +85,13 @@
;count++
;/
- /; if (count > 7)
+ /; if (count > 8)
;to_stack = true
;/
;/
;self.sym_names.append(name)
- ;self.sym_types.append(_type)
- ;self.on_stack.append(to_stack)
-
- /; if (count > 7)
- ;return -1
- ;/
-
- ;return count
+ ;self.sym_vals.append(_type)
;/
# Returns true if the variable is being tracked
@@ -196,6 +186,29 @@
;return out
;/
+# Bool to j
+/; cmp_to_jxt ({}uint8 c) [{}uint8]
+ /; if (string_equate(c, "<"))
+ ;return "l"
+ ;; else if (string_equate(c, ">"))
+ ;return "g"
+ ;; else if (string_equate(c, "!<") || string_equate(c, ">=="))
+ ;return "nl"
+ ;; else if (string_equate(c, "!>") || string_equate(c, "<=="))
+ ;return "ng"
+ ;; else if (string_equate(c, "=="))
+ ;return "e"
+ ;; else if (string_equate(c, "!=="))
+ ;return "ne"
+ ;;
+ ;/
+ ;return "nz"
+;/
+
+/; compute_jmp ({}uint8 jxt, lab) [{}uint8]
+
+;/
+
# Is struct returns true if the type name given is a struct
/; is_struct (VType t) [bool]
/; if (t.ptr > 0)
@@ -701,14 +714,14 @@
;out.write('\n')
- /; loop (int i = 0; i < len csec) [i++]
- ;out.write(csec{i})
+ /; loop (int i = 0; i < len dsec) [i++]
+ ;out.write(dsec{i})
;/
;out.write('\n')
- /; loop (int i = 0; i < len dsec) [i++]
- ;out.write(dsec{i})
+ /; loop (int i = 0; i < len csec) [i++]
+ ;out.write(csec{i})
;/
;out.write('\n')