2023-12-09 17:24:41 +00:00
|
|
|
#ifndef RZ_TYPE_H
|
|
|
|
#define RZ_TYPE_H
|
|
|
|
|
|
|
|
#include "commons.h"
|
|
|
|
|
|
|
|
#define TYPE_KIND(G) \
|
2023-12-20 19:54:58 +00:00
|
|
|
G(TYPE_NUM), G(TYPE_BOOL), G(TYPE_STR), \
|
2023-12-23 20:17:12 +00:00
|
|
|
G(TYPE_FUN), G(TYPE_REF)
|
2023-12-09 17:24:41 +00:00
|
|
|
|
|
|
|
RZ_ENUM_H(TypeKind, TYPE_KIND);
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
TypeKind kind;
|
|
|
|
} type_t;
|
|
|
|
|
|
|
|
void type_init(type_t* type, TypeKind kind);
|
|
|
|
void type_free(type_t* type);
|
|
|
|
|
|
|
|
int type_eq(type_t* type, type_t* rhs);
|
2023-12-17 18:10:17 +00:00
|
|
|
size_t type_str(type_t* type, char* buffer, size_t size);
|
2023-12-09 17:24:41 +00:00
|
|
|
|
|
|
|
#endif
|