summaryrefslogtreecommitdiff
path: root/cc.c
diff options
context:
space:
mode:
authorthing1 <thing1@seacrossedlovers.xyz>2025-03-14 17:37:27 +0000
committerthing1 <thing1@seacrossedlovers.xyz>2025-03-14 17:37:27 +0000
commitaf780dc32cbc9d9a40bec1e2ea538e71001c36aa (patch)
tree6e1386faa63125ba5537e923b933868699df3156 /cc.c
init commitHEADmaster
Diffstat (limited to 'cc.c')
-rw-r--r--cc.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/cc.c b/cc.c
new file mode 100644
index 0000000..0a38f0e
--- /dev/null
+++ b/cc.c
@@ -0,0 +1,33 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "lex.h"
+#include "parse.h"
+#include "types.h"
+
+int main() {
+ FILE *f = fopen("test.c", "r");
+
+ lexobj lexes[4096];
+ int lexcount = 0;
+
+ char *line = malloc(256);
+ while (fgets(line, 256, f) != NULL) {
+ stripwhitespace(line);
+ while (line[0] != 0) {
+ lexes[lexcount] = lex(line);
+ lexcount++;
+ line = saveptr;
+ }
+ char *line = malloc(256);
+ }
+
+ ast exprs[4096];
+ int exprcount;
+
+ while (lexcount > 0) {
+ exprs[exprcount] = genast(lexes, &lexcount);
+ exprcount++;
+ }
+}