1
0
Fork 0
lesson-lisp/object.h

30 lines
591 B
C

#ifndef __OBJECT_H__
#define __OBJECT_H__
#include "enums.h"
#include <stdint.h>
struct Object {
enum Type type;
union {
// For PAIR
struct {
struct Object *a, *b;
} pair;
// For ATOM, STRING
char *s;
// For NUMBER
int64_t i;
};
};
struct Object *Object_new_pair(struct Object *a, struct Object *b);
struct Object *Object_new_atom(const char *s);
struct Object *Object_new_string(const char *s);
struct Object *Object_new_number(int64_t i);
void Object_print(struct Object *self, unsigned indent);
#endif