Separate public header
This commit is contained in:
@@ -18,7 +18,7 @@ LIB_SRCS = [
|
|||||||
"src/utility.c",
|
"src/utility.c",
|
||||||
"src/parse.c",
|
"src/parse.c",
|
||||||
]
|
]
|
||||||
LIB_INCLUDES = ["src/"]
|
LIB_INCLUDES = ["src/", "include/"]
|
||||||
|
|
||||||
|
|
||||||
TEST_SRCS = [
|
TEST_SRCS = [
|
||||||
|
|||||||
53
src/uclisp.h
53
src/uclisp.h
@@ -1,53 +0,0 @@
|
|||||||
#ifndef _UCLISP_H_
|
|
||||||
#define _UCLISP_H_
|
|
||||||
|
|
||||||
enum ucl_type {
|
|
||||||
UCL_TYPE_CELL = 0,
|
|
||||||
UCL_TYPE_SYMBOL = 1,
|
|
||||||
UCL_TYPE_INT = 2,
|
|
||||||
UCL_TYPE_STRING = 3,
|
|
||||||
UCL_TYPE_ERROR = 4,
|
|
||||||
UCL_TYPE_BUILTIN = 5,
|
|
||||||
UCL_TYPE_SPECIAL = 6, // Like builtins, but special forms where arguments are not necessarily evaluated
|
|
||||||
UCL_TYPE_COUNT = 7,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ucl_cell {
|
|
||||||
struct ucl_object *car;
|
|
||||||
struct ucl_object *cdr;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ucl_scope;
|
|
||||||
typedef struct ucl_object *(*ucl_lisp)(struct ucl_scope* state, struct ucl_object *args);
|
|
||||||
|
|
||||||
struct ucl_object {
|
|
||||||
union {
|
|
||||||
struct ucl_cell cell;
|
|
||||||
const char *symbol;
|
|
||||||
int integer;
|
|
||||||
const char *string;
|
|
||||||
const char *error;
|
|
||||||
ucl_lisp builtin;
|
|
||||||
ucl_lisp special;
|
|
||||||
};
|
|
||||||
enum ucl_type type;
|
|
||||||
char reachable;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct ucl_parse_result {
|
|
||||||
int result;
|
|
||||||
struct ucl_cell *statement;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ucl_scope; // TODO
|
|
||||||
|
|
||||||
struct ucl_object *ucl_tokenize(const char *source);
|
|
||||||
struct ucl_object *ucl_parse(const char *sexp);
|
|
||||||
struct ucl_object *ucl_evaluate(struct ucl_scope *state, struct ucl_object *sexp);
|
|
||||||
|
|
||||||
// TODO: State encapsulation is all wonky here)
|
|
||||||
void ucl_gc();
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Reference in New Issue
Block a user