moka/lib/node.h

37 lines
678 B
C
Raw Permalink Normal View History

2024-03-26 18:31:33 +00:00
#ifndef MK_NODE_H
#define MK_NODE_H
#include "commons.h"
#include "token.h"
#include "vec.h"
#include "str.h"
#define NODE_KIND(G) \
G(NODE_ROOT), \
G(NODE_INT), G(NODE_FLOAT), G(NODE_BOOL), \
G(NODE_STRING), G(NODE_SYMBOL), G(NODE_CALL),\
G(NODE_IDENT)
2024-03-26 18:31:33 +00:00
MK_ENUM_H(NodeKind, NODE_KIND);
struct node
{
NodeKind kind;
struct token* token;
struct vec children;
int line;
};
void node_init(struct node* self,
NodeKind kind,
struct token* token,
int line);
void node_free(struct node* self);
void node_str(struct node* self, struct str* str);
void node_add_new_child(struct node* self, struct node* child);
#endif