tiny scheme compiler that aims to be fast and correct
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 

58 lines
883 B

typedef
struct {
size_t size;
char* string;
} sc_string_t;
typedef
union {
sc_string_t string;
double doublev;
int integer;
float floating;
struct closure_t *closure;
} svalue_variants_t;
typedef
enum {
INT = 0,
FLOAT = 1,
DOUBLE = 2,
STRING = 3
} stype_t;
typedef
struct {
stype_t type_tag;
svalue_variants_t value;
} svalue_t;
typedef
struct {
svalue_t *(*func)(svalue_t, svalue_t*);
svalue_t *fvars;
} closure_t;
typedef
struct {
svalue_t head;
struct cell *tail;
}
cell;
svalue_t *
box_value(svalue_variants_t, stype_t);
closure_t
make_closure(svalue_t* (*func)(svalue_t, svalue_t*),
svalue_t*);
svalue_t*
invoke(closure_t, svalue_t);
/*static svalue_t*
make_adder_inner(svalue_t, svalue_t *);
static closure_t
make_adder(svalue_t *);
*/