summaryrefslogtreecommitdiff
path: root/src/analysis/typecheck.h
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-11 15:11:00 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-11 15:11:00 +0000
commit55247a3f12a9eee7ba3fd7ca6d8fcea7a82c20f3 (patch)
treea2a71e2eb8ca0b2c483518c1902d89d18709c9ab /src/analysis/typecheck.h
parent2e7abed7cfe84a2c0df371cde35f8f68cfdca16c (diff)
Added src/ folder. Now I will add the rest.
Diffstat (limited to 'src/analysis/typecheck.h')
-rw-r--r--src/analysis/typecheck.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/analysis/typecheck.h b/src/analysis/typecheck.h
new file mode 100644
index 0000000..fe51c4d
--- /dev/null
+++ b/src/analysis/typecheck.h
@@ -0,0 +1,23 @@
+#ifndef TYPECHECK_H
+#define TYPECHECK_H
+
+#include "ast.h"
+#include "parser.h"
+
+// Type Checker Context
+// Holds the state during the semantic analysis pass.
+// Unlike the parser, this focuses on semantic validity (types, definitions).
+typedef struct TypeChecker
+{
+ ParserContext *pctx; // Reference to global parser context (for lookups)
+ Scope *current_scope; // Current lexical scope
+ ASTNode *current_func; // Current function being checked (for return type checks)
+ int error_count; // Number of errors found
+ int warning_count; // Number of recommendations/warnings
+} TypeChecker;
+
+// Main Entry Point
+// Returns 0 on success (no errors), non-zero if errors occurred.
+int check_program(ParserContext *ctx, ASTNode *root);
+
+#endif // TYPECHECK_H