summaryrefslogtreecommitdiff
path: root/tnslc
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2024-03-26 04:49:17 -0400
committerKyle Gunger <kgunger12@gmail.com>2024-03-26 04:49:17 -0400
commit3574a95ecb54c3e88f2f897ae919435d92ec0241 (patch)
treeb2a934e4db3c00601ec8aa6e2b1692fc4b8ab228 /tnslc
parent6c1f5cf72ffd6ed9a3f70395881613fa53e27758 (diff)
generator func
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
;/