Skip to content

Commit 96c3288

Browse files
committed
feat: Add core compiler components including parser, type checker, IR generator with async/await support, and LLVM backend.
1 parent 2de119c commit 96c3288

6 files changed

Lines changed: 5 additions & 36 deletions

File tree

include/vm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ struct VM {
2626
Table globals;
2727
Table strings;
2828
Obj* objects;
29+
struct ObjUpvalue* openUpvalues;
2930

3031
// GC State
3132
int grayCount;

src/compiler/backend_llvm.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ class LLVMEmitter {
395395
Builder->SetInsertPoint(CleanupBB);
396396
// ... free ...
397397
llvm::Function* FCoroFree = ModuleOb->getFunction("llvm.coro.free");
398+
(void)FCoroFree;
398399
// We need ID for free... complex to propagate ID everywhere.
399400
// For skeleton, trap.
400401
Builder->CreateUnreachable();

src/compiler/ir_gen.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ static int visitExpr(IRGen* gen, Expr* expr) {
165165
// The snippet had EXPR_LITERAL, BINARY, VAR, ASSIGN. NO EXPR_CALL.
166166
// So I need to implement a hack for calling runtime helper using IR_OP_CALL logic manually.
167167

168-
IRInstruction* instr = createIRInstruction(IR_OP_CALL, r);
169-
IROperand opFunc, opArg;
168+
// IRInstruction* instr = createIRInstruction(IR_OP_CALL, r);
169+
// IROperand opFunc, opArg;
170170

171171
// Op 0: Function Name
172172
opFunc.type = OPERAND_CONST;

src/compiler/parser/parser.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -112,27 +112,6 @@ static Token consume(Parser *p, PxTokenType type, const char *message) {
112112
return peek(p); // Return current token on error
113113
}
114114

115-
static void synchronize(Parser *p) {
116-
advance(p);
117-
while (!isAtEnd(p)) {
118-
if (previous(p).type == TOKEN_SEMICOLON)
119-
return;
120-
121-
switch (peek(p).type) {
122-
case TOKEN_CLASS:
123-
case TOKEN_FUNC:
124-
case TOKEN_LET:
125-
case TOKEN_FOR:
126-
case TOKEN_IF:
127-
case TOKEN_RETURN:
128-
return;
129-
default:
130-
break;
131-
}
132-
133-
advance(p);
134-
}
135-
}
136115

137116
// Helper to extract token value as string
138117
static char *tokenToString(Token token) {

src/compiler/type_checker.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,6 @@ static bool isTypesEqual(TypeInfo t1, TypeInfo t2) {
3131
return true;
3232
}
3333

34-
static const char* typeToString(TypeKind kind) {
35-
switch (kind) {
36-
case TYPE_UNKNOWN: return "Unknown";
37-
case TYPE_VOID: return "Void";
38-
case TYPE_BOOL: return "Bool";
39-
case TYPE_INT: return "Int";
40-
case TYPE_FLOAT: return "Float";
41-
case TYPE_STRING: return "String";
42-
case TYPE_FUNCTION: return "Function";
43-
case TYPE_CLASS: return "Class";
44-
default: return "Invalid";
45-
}
46-
}
4734

4835
// --- Symbol Table Helpers ---
4936

src/prm/builder.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ static void invoke_compiler(const char* file, bool run) {
4141
}
4242

4343
void prm_build(const Manifest* manifest, bool releaseMode) {
44+
(void)releaseMode;
4445
printf("[PRM] Building project: %s v%s\n", manifest->name, manifest->version);
4546
// Phase 1: Just invoke compiler on entry point
4647
invoke_compiler(manifest->entryPoint, false);

0 commit comments

Comments
 (0)