summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--tnslc/ast/list.tnsl4
-rw-r--r--tnslc/ast/value.tnsl14
-rw-r--r--tnslc/compile/arch/isa_x86.tnsl14
-rw-r--r--tnslc/compile/compile.tnsl10
-rw-r--r--tnslc/dummy.tnsl9
-rw-r--r--tnslc/parse/token.tnsl7
-rw-r--r--tnslc/parse/tokenizer.tnsl2
-rwxr-xr-xtnslc/run.sh4
-rw-r--r--tnslc/tnslc.tnsl2
10 files changed, 56 insertions, 11 deletions
diff --git a/.gitignore b/.gitignore
index 1714ffd..1f08b40 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1 @@
-parse
tint
diff --git a/tnslc/ast/list.tnsl b/tnslc/ast/list.tnsl
index b9d8080..da6a682 100644
--- a/tnslc/ast/list.tnsl
+++ b/tnslc/ast/list.tnsl
@@ -29,7 +29,7 @@
/; loop (cur` < len tok`) [cur` = cur` + 1]
;Node stmt = tree_statement(tok, cur)
- ;append(out, stmt)
+ ;out.append(stmt)
;Token tmp = tok`{cur`}
/; if (string_equate(tmp.data, "]") || string_equate(tmp.data, ")"))
@@ -58,7 +58,7 @@
;Node tmp
/; if (type_then_name(tok, cur))
;tmp = tree_type(tok, cur)
- ;append(out, tmp)
+ ;out.append(tmp)
;/
;tmp = tree_value(tok, cur)
diff --git a/tnslc/ast/value.tnsl b/tnslc/ast/value.tnsl
index d90c00a..d4cef56 100644
--- a/tnslc/ast/value.tnsl
+++ b/tnslc/ast/value.tnsl
@@ -14,9 +14,21 @@
EXPRESS OR IMPLIED
#/
-/; tree_type [Node]
+/; tree_type (~{}Token tok, ~int cur) [Node]
;Token type_tok = {NODE_TYPE.TYPE, 0, 0, ~CNULL}
;{}Node type_sub = {}
+
+ # Pre type keyword checks
+ /; loop (tok`{cur`}.token_type !== TOKEN_TYPE.DEFWORD && tok`{cur`}.token_type !== TOKEN_TYPE.KEYTYPE)
+ /; if (tok`{cur`}.token_type == TOKEN_TYPE.KEYWORD)
+
+ ;/
+ ;/
+
+ /;
+
+ ;/
+
;return {type_tok, ~type_sub}
;/
diff --git a/tnslc/compile/arch/isa_x86.tnsl b/tnslc/compile/arch/isa_x86.tnsl
index 0dc3468..03646ce 100644
--- a/tnslc/compile/arch/isa_x86.tnsl
+++ b/tnslc/compile/arch/isa_x86.tnsl
@@ -13,3 +13,17 @@
WARRANTY, GUARANTEE, OR CLAIM OF FITNESS FOR ANY PURPOSE
EXPRESS OR IMPLIED
#/
+
+
+
+/; gen_symtab (Node program) [Symtab]
+
+;/
+
+/; symtab_to_section (Symtab sym) [{}charp]
+
+;/
+
+/; block_to_asm ({}charp block_name, Node block) [{}charp]
+
+;/
diff --git a/tnslc/compile/compile.tnsl b/tnslc/compile/compile.tnsl
index 2787eba..df94752 100644
--- a/tnslc/compile/compile.tnsl
+++ b/tnslc/compile/compile.tnsl
@@ -16,7 +16,7 @@
/; module compile
# :include "compile/arch/arch.tnsl"
- :include "compile/format/format.tnsl"
+ :include "compile/arch/isa_x86.tnsl"
# :include "compile/comp.tnsl"
;/
@@ -24,3 +24,11 @@
/; do_compile ({}charp file, ast.Node data, Settings settings)
;/
+
+;struct Symtab {
+ {}{}charp
+ sym_names,
+
+ {}uint
+ sym_sizes
+}
diff --git a/tnslc/dummy.tnsl b/tnslc/dummy.tnsl
index 2aa55a7..12b082e 100644
--- a/tnslc/dummy.tnsl
+++ b/tnslc/dummy.tnsl
@@ -1,5 +1,12 @@
;int a = 0x11
+;bool aaaa = false
/; main
- ;tnsl.io.println(a)
+ /; if (a !== 11)
+ ;tnsl.io.println(a)
+ ;/
+
+ /; loop (!aaaa) [a !== 17]
+ ;tnsl.io.println("Looping!")
+ ;/
;/
diff --git a/tnslc/parse/token.tnsl b/tnslc/parse/token.tnsl
index e7d64e7..bf4d470 100644
--- a/tnslc/parse/token.tnsl
+++ b/tnslc/parse/token.tnsl
@@ -250,6 +250,13 @@
;return true
;/
+/; is_text_literal(~{}charp dat) [bool]
+ /; if (len dat` < 1)
+ ;return false
+ ;/
+ ;return dat`{0} == '"' || dat`{0} == '\''
+;/
+
/; string_closed ({}charp dat, charp c) [bool]
/; if (len dat < 2)
;return false
diff --git a/tnslc/parse/tokenizer.tnsl b/tnslc/parse/tokenizer.tnsl
index 7a1f085..9021369 100644
--- a/tnslc/parse/tokenizer.tnsl
+++ b/tnslc/parse/tokenizer.tnsl
@@ -91,7 +91,7 @@
;/
;/
- /; if ( !is_whitespace(i) && !comment )
+ /; if ( (!is_whitespace(i) || is_text_literal(~tdat)) && !comment )
;tdat.append(i)
;; else if (i == '\n')
;line++
diff --git a/tnslc/run.sh b/tnslc/run.sh
index 982ebf7..e02b7fd 100755
--- a/tnslc/run.sh
+++ b/tnslc/run.sh
@@ -1,5 +1,3 @@
#!/bin/bash
-echo $1
-
-../tint -in tnslc.tnsl -flags "$1"
+../tint -quiet -in tnslc.tnsl -flags "$1"
diff --git a/tnslc/tnslc.tnsl b/tnslc/tnslc.tnsl
index 1120745..7ea58df 100644
--- a/tnslc/tnslc.tnsl
+++ b/tnslc/tnslc.tnsl
@@ -38,7 +38,7 @@
;tnslc.print_tokens(psrc)
- ;tnslc.Node tree_node = tnslc.ast.make_tree(psrc, args{0})
+ # ;tnslc.Node tree_node = tnslc.ast.make_tree(psrc, args{0})
;return 0
;/