summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Gunger <kgunger12@gmail.com>2026-07-08 02:30:07 -0400
committerKai Gunger <kgunger12@gmail.com>2026-07-08 02:30:07 -0400
commitb45c3e6a23f659d62e02ad420f7cecd86ff07df5 (patch)
treeea213f812fc9e580b9347019fe98fa71b5bb5981
parentf7ececd879b731194f64123f746ac49b7781fc68 (diff)
[tnslc] first bootstrap attempt pending
-rw-r--r--tnslc/compile/function.tnsl9
-rw-r--r--tnslc/compile/var.tnsl4
-rw-r--r--tnslc/parse/ast.tnsl5
-rw-r--r--tnslc/parse/tokenizer.tnsl2
4 files changed, 5 insertions, 15 deletions
diff --git a/tnslc/compile/function.tnsl b/tnslc/compile/function.tnsl
index 19f3566..0de6451 100644
--- a/tnslc/compile/function.tnsl
+++ b/tnslc/compile/function.tnsl
@@ -706,12 +706,13 @@ struct Function {
_print_num("%d)\n\0", expected)
_printf("ERROR: To return multiple values enclose them in {}\n\0")
_printf("ERROR: To add more return values, add them (comma separated) between [] at the end of the function definition\n\0")
+ _printf("ERROR: OFFENDING FUNCTION:\n\0")
+ self._print(0)
return false
;/
/; _compile_return_vals (~Scope s, ~parse.Node n)
- _printf("Compiling return vals!\n\0")
/; if (self.outputs.count == 0)
return
;/
@@ -860,13 +861,10 @@ struct Function {
# Generate result tmp if required
out = f`.outputs.get(0)
/; if (out`.loc < 0)
- _printf("Making tmp!\n\0")
result = s`.mk_tmp_stack(out)
;; else
- _printf("Grabbing copy!\n\0")
result = out`.copy()
;/
- result._print(0)
;; else
~Struct t = self._find_literal_type(s, "void\0")
result._init(t)
@@ -1475,7 +1473,6 @@ struct Function {
s`.free_after(~lhs, true)
;/
- _printf("COMPILE_BOOL_OP\n\0")
/; if (lhs.is_struct() == true)
_printf("Can not use struct as boolean value\n\0")
lhs.end()
@@ -1527,7 +1524,6 @@ struct Function {
# Compute right hand side
Var rhs = self._compile_value(s, rhn)
- _printf("COMPILE_BOOL_OP\n\0")
/; if (rhs.is_struct() == true)
_printf("Can not use struct as boolean value\n\0")
lhs.end()
@@ -1617,7 +1613,6 @@ struct Function {
# Compute right hand side
Var rhs = self._compile_value(s, rhn)
- _printf("COMPILE_CMP_OP\n\0")
# Check not structs
/; if (lhs.is_struct() == true || rhs.is_struct() == true)
_printf("Can not compare structs in this version of tnsl\n\0")
diff --git a/tnslc/compile/var.tnsl b/tnslc/compile/var.tnsl
index 4b023a7..4735021 100644
--- a/tnslc/compile/var.tnsl
+++ b/tnslc/compile/var.tnsl
@@ -372,6 +372,8 @@ struct Var {
_printf("ERROR: Tried to find method \"\0")
_printf(name)
_printf("\" on a variable but we had a pointer in the chain\n\0")
+ _printf("ERROR: OFFENDING VARIABLE:\n\0")
+ self._print(0)
return false
;/
;/
@@ -944,7 +946,6 @@ struct Var {
# Typechecking structs
/; _tc_struct (~Var other) [bool]
- _printf("TC_STRUCT\n\0")
/; if (other`.is_struct() == false)
return false
;/
@@ -1325,7 +1326,6 @@ struct Var {
~int32 p = vcpy.ptrc.get(idx)
p` = set
;; else
- _printf("TAKE_PTR\n\0")
/; if (self.is_struct() == true)
self._set_struct_r(buf, reg)
;; else
diff --git a/tnslc/parse/ast.tnsl b/tnslc/parse/ast.tnsl
index fea6421..b517e41 100644
--- a/tnslc/parse/ast.tnsl
+++ b/tnslc/parse/ast.tnsl
@@ -919,8 +919,6 @@ int errors_shown = 0
uint8 end = _get_closing_delim(first`.data`)
first` = produce_next_token(fin, first`)
- int ln = first`.line
-
/; loop (bool run = true; run == true && first`._type !== TTYPE_ERR && first`.data` !== end)
/; if (_advance_check(fin, first, "asm\0") == true)
_ast_asm(fin, ~list, first)
@@ -951,8 +949,6 @@ int errors_shown = 0
mod`.add_child(~list)
- ln = first`.line
-
/; if (first`._type !== TTYPE_DELIM || first`.data` !== end)
_ast_print_err(fin, first, "Expected closing at end of statement list\0")
;; else
@@ -961,7 +957,6 @@ int errors_shown = 0
first` = tmp
;/
- return ln
;/
diff --git a/tnslc/parse/tokenizer.tnsl b/tnslc/parse/tokenizer.tnsl
index b60e57c..5c742b1 100644
--- a/tnslc/parse/tokenizer.tnsl
+++ b/tnslc/parse/tokenizer.tnsl
@@ -428,7 +428,7 @@ uint MAX_MULTI = 3
/; print_token_list (~utils.Vector vec)
~Token tok
/; loop (uint i = 0; i < vec`.count) [i++]
- tok = vec.get(i)
+ tok = vec`.get(i)
print_token(tok`)
;/
;/