aboutsummaryrefslogtreecommitdiff
path: root/src/as_main.c
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2025-03-26 19:11:10 +0800
committerMistivia <i@mistivia.com>2025-03-26 19:11:10 +0800
commit97d4462ac24b726d9313ec52ca0f11711ead553b (patch)
tree1bba7f6d4f2690d673b810bda4ec34523034bcaa /src/as_main.c
parent312716a295626f2b60b41777728c7f220fee843d (diff)
delete fvm-asHEADmaster
Diffstat (limited to 'src/as_main.c')
-rw-r--r--src/as_main.c42
1 files changed, 0 insertions, 42 deletions
diff --git a/src/as_main.c b/src/as_main.c
deleted file mode 100644
index cd9251b..0000000
--- a/src/as_main.c
+++ /dev/null
@@ -1,42 +0,0 @@
-#include <stdio.h>
-
-#include "as_tokenizer.h"
-#include "as_analyzer.h"
-#include "as_parser.h"
-#include "as_codegen.h"
-#include "utils.h"
-
-result main_impl(int argc, char** argv) {
- if (argc != 3) {
- return err("usage: fvm-as <input_file> <output_file>");
- }
- struct allocator * alct = new_allocator();
- FILE *fp = fopen(argv[1], "r");
- token_stream * ts = new_token_stream(alct, fp);
- prog* prog = unwrap(parse_prog(alct, ts));
- sym_table symtbl = analyze_prog(alct, prog);
- bytearray* output = unwrap(codegen(alct, prog, symtbl));
- fclose(fp);
-
- fp = fopen(argv[2], "wb");
- if (fp == NULL) {
- return err("open output file failed.");
- }
- int ret =fwrite(output->buf, 1, output->len, fp);
- if (ret != output->len) {
- return err("write output file failed.");
- }
- fclose(fp);
-
- delete_allocator(alct);
- return ok(NULL);
-}
-
-int main(int argc, char** argv) {
- result result = main_impl(argc, argv);
- if (result.errmsg != NULL) {
- fprintf(stderr, "%s\n", result.errmsg);
- return -1;
- }
- return 0;
-}