added some test code to main.c

This commit is contained in:
Richard Thier 2024-09-26 12:32:58 +02:00
parent d35b55194f
commit aaa8b2fb9c

54
main.c
View File

@ -1,10 +1,64 @@
#include <stdio.h>
#include <stddef.h> // 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;
}