starting lisp core
This commit is contained in:
39
stage2/include/lisp.h
Normal file
39
stage2/include/lisp.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
#define SYMBOL_TABLE_SIZE 2048
|
||||
|
||||
typedef char * symbol_t;
|
||||
|
||||
#define TYPE_SYMBOL 1
|
||||
#define TYPE_NUMBER 2
|
||||
#define TYPE_STRING 3
|
||||
#define TYPE_FLOAT 4
|
||||
#define TYPE_LIST 5
|
||||
|
||||
|
||||
#define symbolp(x) (x->type == TYPE_SYMBOL)
|
||||
#define numberp(x) (x->type == TYPE_NUMBER)
|
||||
#define stringp(x) (x->type == TYPE_STRING)
|
||||
#define floatp(x) (x->type == TYPE_FLOAT)
|
||||
#define listp(x) (x->type == TYPE_LIST)
|
||||
|
||||
|
||||
typedef struct cell {
|
||||
uint8_t type;
|
||||
union {
|
||||
struct {
|
||||
cell *head;
|
||||
cell *tail;
|
||||
};
|
||||
struct {
|
||||
union {
|
||||
symbol_t sym;
|
||||
int num;
|
||||
char *str;
|
||||
float fnum;
|
||||
};
|
||||
};
|
||||
};
|
||||
} cell_t;
|
||||
|
||||
10
stage2/include/memory.h
Normal file
10
stage2/include/memory.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include <cstddef>
|
||||
|
||||
// memory.h contains the memory management code for the system.
|
||||
// right now, it uses the stdlib malloc/free directly.
|
||||
//
|
||||
// TODO(kyle): switch to arena memory.
|
||||
|
||||
void *sys_malloc(size_t);
|
||||
void sys_free(void *);
|
||||
8
stage2/include/neopixel.h
Normal file
8
stage2/include/neopixel.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
namespace neopxl {
|
||||
|
||||
void start();
|
||||
bool blink(bool);
|
||||
|
||||
} // namespace neopxl
|
||||
Reference in New Issue
Block a user