From 3574a95ecb54c3e88f2f897ae919435d92ec0241 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Tue, 26 Mar 2024 04:49:17 -0400 Subject: generator func --- tnslc/tnslc.tnsl | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'tnslc/tnslc.tnsl') 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 ;/ -- cgit v1.2.3