wip: working on classes

This commit is contained in:
samsonium
2026-10-15 21:41:45 +03:00
parent 69b2253c34
commit 683dd08181
6 changed files with 532 additions and 276 deletions
+21 -1
View File
@@ -1,7 +1,6 @@
#ifndef FZL_PARSER_H
#define FZL_PARSER_H
#include "common/fzl_types.h"
#include <compiler/fzl_reader.h>
#include <compiler/fzl_token.h>
#include <stddef.h>
@@ -16,6 +15,8 @@ typedef enum
FZL_NODETYPE_CONDITIONAL,
FZL_NODETYPE_FUNCTION,
FZL_NODETYPE_RETURN,
FZL_NODETYPE_CLASS,
FZL_NODETYPE_FIELD,
FZL_NODETYPE_ADD,
FZL_NODETYPE_SUB,
@@ -113,6 +114,25 @@ typedef struct fzl_node
{
struct fzl_node *value;
} ret;
// Class declaration
struct
{
fzl_token_t *name;
struct fzl_node **fields;
size_t fields_count;
struct fzl_node **methods;
size_t methods_count;
} class;
// Member access
struct
{
struct fzl_node *parent;
struct fzl_node *field;
} memb;
};
} fzl_node_t;
+5 -1
View File
@@ -8,7 +8,11 @@
// Token type
typedef enum
{
FZL_TOKTYPE_RETURN, // return
FZL_TOKTYPE_CLASS, // class
FZL_TOKTYPE_NEW, // new
FZL_TOKTYPE_FUNCTION, // fn
FZL_TOKTYPE_RETURN, // return
FZL_TOKTYPE_IF, // if
FZL_TOKTYPE_ELSE, // else