wip: working on analyzer

- Feat: add binary math analysis
- Fix: check for function context in block analysis
- Feat: add 'break' analysis
- Fix: few fixes in call analysis
- Feat: add class analysis
- Feat: add construct analysis
- Feat: add declaration analysis
- Feat: add field analysis
- Feat: add function analysis
- Feat: add loop analysis
- Ref: updated utilities and context functions
This commit is contained in:
samsonium
2026-10-27 05:18:36 +03:00
parent d7630dbb6a
commit 25991c6f15
17 changed files with 1094 additions and 30 deletions
+34 -1
View File
@@ -1,7 +1,7 @@
#include "compiler/fzl_token.h"
#include <common/fzl_types.h>
#include <compiler/fzl_analyzer.h>
#include <compiler/fzl_parser.h>
#include <compiler/fzl_token.h>
#include <stddef.h>
#include <stdlib.h>
@@ -11,6 +11,39 @@ fzl_an_res_t analyze_common(fzl_analyzer_t *analyzer, fzl_node_t *node)
fzl_an_res_t res = {.error = false, .type = FZL_TYPE_NULL, .classname = NULL};
switch (node->type)
{
case FZL_NODETYPE_ADD:
case FZL_NODETYPE_SUB:
case FZL_NODETYPE_MUL:
case FZL_NODETYPE_DIV:
case FZL_NODETYPE_POW:
case FZL_NODETYPE_MOD:
res = analyze_binmath(analyzer, node);
break;
case FZL_NODETYPE_BREAK:
res = analyze_break(analyzer, node);
break;
case FZL_NODETYPE_LOOP:
res = analyze_loop(analyzer, node);
break;
case FZL_NODETYPE_CONSTRUCT:
res = analyze_construct(analyzer, node);
break;
case FZL_NODETYPE_DECLARATION:
res = analyze_declaration(analyzer, node);
break;
case FZL_NODETYPE_FIELD:
res = analyze_field(analyzer, node);
break;
case FZL_NODETYPE_CLASS:
res = analyze_class(analyzer, node);
break;
case FZL_NODETYPE_RETURN:
res = analyze_return(analyzer, node);
break;