#ifndef PEBBLISP_H #define PEBBLISP_H // #define STANDALONE // #define NO_REPL #include "object.h" struct Slice { const char *text; char length; }; typedef struct Result { Object obj; struct Slice *slices; } Result; struct Environment { char **strings; Object *objects; struct Environment *outer; }; Object eval(const Object *obj, struct Environment *env); Result parse(struct Slice *slices); Result readSeq(struct Slice *slices); Object parseAtom(struct Slice *slice); void copySlice(char * dest, struct Slice *src); Object parseEval(const char *input, struct Environment *env); void eval_forms(Object *destList, const Object *src, struct Environment *env); Object evalLambdaArgs(const Object *arg_forms); struct Environment defaultEnv(); void deleteEnv(struct Environment *e); void addToEnv(struct Environment *env, const char *name, const Object obj); Object fetchFromEnvironment(const char *name, struct Environment *env); void printEnv(struct Environment *env); Result resultFromObjAndSlices(Object obj, struct Slice *slices); Object add(Object obj1, Object obj2); // Slices void copySlice(char * dest, struct Slice *src); void debugSlice(struct Slice *s); #define R(_obj, _slices) resultFromObjAndSlices(_obj, _slices) #endif