wip: working on analyzer

- Feat: add `nest_ctx` and `fin_ctx` fns for working with context and
environment
- Feat: add block analyzer
- Feat: add conditional statement analyzer
This commit is contained in:
samsonium
2026-10-26 21:34:54 +03:00
parent 62ae05b4cd
commit a70ad011f3
9 changed files with 165 additions and 35 deletions
+10 -7
View File
@@ -3,6 +3,7 @@
#include <compiler/fzl_analyzer.h>
#include <compiler/fzl_parser.h>
#include <stddef.h>
#include <stdlib.h>
// Analyzer main function
fzl_an_res_t analyze_common(fzl_analyzer_t *analyzer, fzl_node_t *node)
@@ -10,18 +11,20 @@ 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_FUNCTION:
res = analyze_function(analyzer, node);
break;
case FZL_NODETYPE_CONDITIONAL:
res = analyze_conditional(analyzer, node);
break;
case FZL_NODETYPE_IDENTIFIER:
res = analyze_identifier(analyzer, node);
break;
case FZL_NODETYPE_BLOCK:
for (size_t i = 0; i < node->list.entry_count; i++)
{
fzl_an_res_t entry_res =
analyze_common(analyzer, node->list.entries[i]);
if (entry_res.error)
res.error = true;
}
res = analyze_block(analyzer, node);
break;
case FZL_NODETYPE_CALL: