29 lines
429 B
C
29 lines
429 B
C
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
#define SIZE 8
|
|
#define BROKEN_HEART 1
|
|
#define CONS 2
|
|
#define INTEGER 3
|
|
|
|
typedef struct box_t {
|
|
char type;
|
|
union {
|
|
int integer;
|
|
struct cons_t* cons;
|
|
};
|
|
} box_t;
|
|
|
|
typedef struct cons_t {
|
|
box_t car;
|
|
box_t cdr;
|
|
} cons_t;
|
|
|
|
void init();
|
|
cons_t *alloc();
|
|
void gc_run();
|
|
void gc_loop();
|
|
void relocate(cons_t*);
|