Skip to content

Commit c3700de

Browse files
committed
Optimize: Integrate AST optimizer into compilation pipeline
1 parent 1213b0a commit c3700de

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/main.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ static void repl() {
100100
}
101101

102102
// --- Pipeline: AST -> Bytecode -> VM ---
103+
optimizeAST(statements);
104+
103105
ObjFunction* function = newFunction();
104106
push(&vm, OBJ_VAL(function));
105107

@@ -150,6 +152,7 @@ static char *readFile(const char *path) {
150152
}
151153

152154
#include "type_checker.h"
155+
#include "optimizer.h"
153156

154157
static void runFile(const char *path) {
155158
char *source = readFile(path);
@@ -208,7 +211,10 @@ static void runFile(const char *path) {
208211
exit(65);
209212
}
210213

211-
// --- Pipeline Step 2: Type Checking ---
214+
// --- Pipeline Step 2: Optimization ---
215+
optimizeAST(statements);
216+
217+
// --- Pipeline Step 3: Type Checking ---
212218
TypeChecker checker;
213219
initTypeChecker(&checker);
214220

0 commit comments

Comments
 (0)