decide value representation

This commit is contained in:
Yuichi Nishiwaki 2013-10-10 16:34:24 +09:00
parent 68a7420ba4
commit ebffe5a22e
2 changed files with 40 additions and 0 deletions

View File

@ -1,6 +1,8 @@
#ifndef PICRIN_H__ #ifndef PICRIN_H__
#define PICRIN_H__ #define PICRIN_H__
#include "picrin/value.h"
typedef struct { typedef struct {
} pic_state; } pic_state;

38
include/picrin/value.h Normal file
View File

@ -0,0 +1,38 @@
#ifndef VALUE_H__
#define VALUE_H__
enum pic_vtype {
PIC_VTYPE_HEAP
};
typedef struct {
enum pic_vtype type;
union {
void *data;
} u;
} pic_value;
enum pic_tt {
PIC_TT_PAIR,
PIC_TT_SYMBOL
};
#define PIC_OBJECT_HEADER \
enum pic_tt tt;
struct pic_object {
PIC_OBJECT_HEADER
};
struct pic_pair {
PIC_OBJECT_HEADER
pic_value car;
pic_value cdr;
};
struct pic_symbol {
PIC_OBJECT_HEADER
char *name;
};
#endif