diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2022-10-06 12:26:42 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2022-10-06 12:26:42 -0400 |
commit | f4bc4570be7a51b00bf44d5bd4be99108dd94a30 (patch) | |
tree | abb6b32ac979d7dc0bdf1792d86b0daca8818525 /tnslc | |
parent | a58e2685b815a5a0d2d5f07bc3ae53016ba6f52b (diff) |
Libtnsl additions
Diffstat (limited to 'tnslc')
-rw-r--r-- | tnslc/compile/compile.tnsl | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/tnslc/compile/compile.tnsl b/tnslc/compile/compile.tnsl index 0aade7b..a178d25 100644 --- a/tnslc/compile/compile.tnsl +++ b/tnslc/compile/compile.tnsl @@ -43,25 +43,23 @@ # Null type ;VType NT = {0, "null"} -/; find_var ({}charp name, ~VTrack tab) [{}charp] - /; loop (int i = 0; i < 8) [i++] +/; name_to_index ({}charp name, ~VTrack tab) [int] + /; loop (int i = 0; i < len tab`.sym_names) [i++] /; if (string_equate(tab`.sym_names{i}, name)) - ;{}charp out = "r" - ;{}charp n = string_from_int(i + 8) - ;add_strings(~out, ~n) - /; if (tab`.sym_sizes{i}._size == 4) - ;out.append('d') - ;; else if (tab`.sym_sizes{i}._size == 2) - ;out.append('w') - ;; else if (tab`.sym_sizes{i}._size == 1) - ;out.append('b') - ;/ - ;return out + ;return i ;/ ;/ ;tnsl.io.print("Failed to find vairable ") ;tnsl.io.println(name) + + ;return -1 +;/ + +/; index_to_loc (int index, ~VTrack tab) [{}charp] + ;{}charp out = "" + + ;/ /; token_is(~int cur, ~{}Token data, {}charp str) [bool] |