summaryrefslogtreecommitdiff
path: root/src/analysis/typecheck.h
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-26 02:23:19 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-26 02:23:19 +0000
commit894e4c69cc10242fc49bcaadf76b672607867d67 (patch)
tree426fa1ae0d21594e9f44a0db153c182eadf46cbd /src/analysis/typecheck.h
parent98cc55d6fce0327b35030e167e2bc9411321737e (diff)
Improved doxygen docs
Diffstat (limited to 'src/analysis/typecheck.h')
-rw-r--r--src/analysis/typecheck.h27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/analysis/typecheck.h b/src/analysis/typecheck.h
index fe51c4d..b690f1d 100644
--- a/src/analysis/typecheck.h
+++ b/src/analysis/typecheck.h
@@ -7,17 +7,30 @@
// Type Checker Context
// Holds the state during the semantic analysis pass.
// Unlike the parser, this focuses on semantic validity (types, definitions).
+/**
+ * @brief Type Checker Context.
+ *
+ * Holds the state during the semantic analysis pass.
+ * Unlike the parser, this focuses on semantic validity (types, definitions, correctness).
+ */
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
+ ParserContext *pctx; ///< Reference to global parser context (for lookups).
+ Scope *current_scope; ///< Current lexical scope during traversal.
+ ASTNode *current_func; ///< Current function being checked (for return type checks).
+ int error_count; ///< Number of type errors found.
+ int warning_count; // Number of recommendations/warnings.
} TypeChecker;
-// Main Entry Point
-// Returns 0 on success (no errors), non-zero if errors occurred.
+/**
+ * @brief Main Type Checking Entry Point.
+ *
+ * Performs semantic analysis on the entire AST.
+ *
+ * @param ctx Global parser context.
+ * @param root Root AST node of the program.
+ * @return 0 on success (no errors), non-zero if errors occurred.
+ */
int check_program(ParserContext *ctx, ASTNode *root);
#endif // TYPECHECK_H