diff --git a/main.c b/main.c index 627f18c..ec07b0d 100644 --- a/main.c +++ b/main.c @@ -1,10 +1,64 @@ #include +#include // NULL #include "hamt.h" #include "turbolist/turbolist.h" + +#define SLC_DEBUG #include "engine/slc.h" +symptr nopsym(SLC_SYM_OP op, char *key, symptr ptr) { + symptr ret; + ret.worp = NULL; + return ret; +} + +uint32_t nopstack(SLC_STACK_OP op, uint32_t param) { + return 0; +} + +uint32_t nopsession(SLC_SESSION_OP op, uint32_t i, uint32_t j) { + return (uint32_t) -1; +} + +iores nopioconn(SLC_IO_OP op, const char *param) { + iores ret; + ret.ptr = NULL; + return ret; +} + +char testcoderead() { + static int i = 0; + static const char *code = + "// This is a small test program push(42)\n" + "/*#push(21)\n" + "#push(21)\n" + "#add*/\n" + "#push(42)\n" + "#print\n"; + return code[i++]; +} + int main(int argc, const char **argv) { // TODO: Implement CLI frontend... puts("TODO: Implement CLI frontend..."); + + // TODO: test code removal + slc( + testcoderead, // code_src + nopsession, // session_storage + nopsym, // symbol_table + nopstack, // code_stack + nopstack, // nesting_stack + nopstack, // data_stack + nopstack, // insert_stack + nopioconn, // io_connector + "//", // singleline_comment + "/*", // multiline_comment_opener + "*/", // multiline_comment_closer, + "#", // prefix + "#", // ender + "@" // varprefix + ); + return 0; }