diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2024-03-26 04:49:17 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2024-03-26 04:49:17 -0400 |
commit | 3574a95ecb54c3e88f2f897ae919435d92ec0241 (patch) | |
tree | b2a934e4db3c00601ec8aa6e2b1692fc4b8ab228 /tnslc/tnslc.tnsl | |
parent | 6c1f5cf72ffd6ed9a3f70395881613fa53e27758 (diff) |
generator func
Diffstat (limited to 'tnslc/tnslc.tnsl')
-rw-r--r-- | tnslc/tnslc.tnsl | 32 |
1 files changed, 25 insertions, 7 deletions
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 ;/ |