Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
wesuRage committed Dec 17, 2024
2 parents 8223459 + 19b51cd commit a525e05
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
12 changes: 12 additions & 0 deletions include/frontend/checker/common_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef COMMON_TYPES_H
#define COMMON_TYPES_H
#include <string.h>

#define ISTYPE(typedf, tname) (strcmp(typedf->name, tname) == 0)

#define ISINT(typedf) ISTYPE(typedf, "int")
#define ISFLOAT(typedf) ISTYPE(typedf, "decimal")
#define ISSTRING(typedf) ISTYPE(typedf, "string")


#endif //COMMON_TYPES_H
15 changes: 10 additions & 5 deletions include/frontend/checker/core.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#ifndef CHECKER_CORE_H
#define CHECKER_CORE_H
#include <map>
#include "../ast/definitions.h"
#include "frontend/ast/definitions.h"

struct TypeDef {
struct Typedef {
char* name;
int id;
Typedef** entries;
}

struct Namespace {
map<char*, TypeDef>* space;
int varcountn
map<char*, Typedef>* space;
int varcountn;
}
struct Checker {
AstNode* ast;
Expand All @@ -20,5 +20,10 @@ struct Checker {
Namespace* typedefs;
}

//TODO: add methods
Checker* init(AstNode* ast);
void push_scope()
void push_variable(Checker* checker, char* name, Typedef* type);
void push_type(Checker* checker, char* tname, Typedef** templates);
TypeDef* check_node(Checker* checker, AstMode* node);
void freeChecker(Checker* checker);
#endif //CHECKER_CORE_H
10 changes: 10 additions & 0 deletions src/frontend/checker/checker.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <iostream>
#extern "C" {
#include "frontend/checker/core.h"
#include "frontend/checker/common_types.h"
#include "utils.h"
}

Checker* init(AstNode* ast) {

}

0 comments on commit a525e05

Please sign in to comment.