35 lines
765 B
C
35 lines
765 B
C
#ifndef DATUM_H
|
|
#define DATUM_H
|
|
|
|
#include <stdint.h>
|
|
|
|
enum datum_type {
|
|
datum_type_i32,
|
|
datum_type_bool,
|
|
datum_type_primitive_proc,
|
|
datum_type_compiled_proc,
|
|
};
|
|
|
|
typedef struct datum {
|
|
enum datum_type type;
|
|
int32_t value;
|
|
struct datum* (*primitive_procedure) (struct datum*);
|
|
void* compiled_procedure_entry;
|
|
void* env;
|
|
struct datum *next;
|
|
} datum;
|
|
|
|
datum* cons(datum *e, datum *xs);
|
|
datum* const_i32(int32_t value);
|
|
datum* const_bool(int32_t value);
|
|
datum* const_primitive_proc(datum* (*primitive_procedure) (datum*));
|
|
int primitive_procedure(datum* d);
|
|
int is_false(datum *d);
|
|
int datum_eq(datum *a, datum *b);
|
|
int datum_lt(datum *a, datum *b);
|
|
void print_datum(datum* d);
|
|
void* compiled_procedure_entry(datum* d);
|
|
|
|
#endif
|
|
|