summaryrefslogtreecommitdiff
path: root/tnslc
diff options
context:
space:
mode:
Diffstat (limited to 'tnslc')
-rw-r--r--tnslc/compile/generator.tnsl3
-rw-r--r--tnslc/file.tnsl9
-rw-r--r--tnslc/tnslc.tnsl32
3 files changed, 37 insertions, 7 deletions
diff --git a/tnslc/compile/generator.tnsl b/tnslc/compile/generator.tnsl
index e69de29..239b0c3 100644
--- a/tnslc/compile/generator.tnsl
+++ b/tnslc/compile/generator.tnsl
@@ -0,0 +1,3 @@
+/; generate (utils.File fin, fout)
+;/
+
diff --git a/tnslc/file.tnsl b/tnslc/file.tnsl
index e69de29..0b24aea 100644
--- a/tnslc/file.tnsl
+++ b/tnslc/file.tnsl
@@ -0,0 +1,9 @@
+struct File {
+ int i
+}
+
+/; method File
+ /; init (~uint8 str)
+ ;/
+
+;/
diff --git a/tnslc/tnslc.tnsl b/tnslc/tnslc.tnsl
index 89fe80b..6269ef2 100644
--- a/tnslc/tnslc.tnsl
+++ b/tnslc/tnslc.tnsl
@@ -7,18 +7,36 @@
:import "compile/compile.tnsl"
-~uint8 HELLO = "hello world\n\0"
+~uint8 DEFAULT_FOUT = "out.asm\0"
-/; main [int]
- utils.Vector vec
+~uint8 USAGE = "
+TNSLC v1.0.0 (C) 2024 CircleShift
- vec.init(1)
+usage:
+ tnslc [options] (file in) [file out]
+
+ -h print this help text
+\0"
- vec.push_cstr(HELLO)
+/; main (int argc, ~~uint8 argv) [int]
+ asm "mov r10, rdi"
+ asm "mov r11, rsi"
- _printf(vec.data)
+ /; if (argc < 2)
+ _printf(USAGE)
+ return 1
+ ;/
- vec.end()
+ utils.File in, out
+
+ in.init(argv{1})
+ /; if (argc < 3)
+ out.init(argv{2})
+ ;; else
+ out.init(DEFAULT_FOUT)
+ ;/
+
+ compile.generate(in, out)
return 0
;/