slc/main.c

65 lines
1.2 KiB
C
Raw Normal View History

2024-09-14 12:54:22 +02:00
#include <stdio.h>
2024-09-26 12:32:58 +02:00
#include <stddef.h> // NULL
2024-09-14 12:54:22 +02:00
#include "hamt.h"
#include "turbolist/turbolist.h"
2024-09-26 12:32:58 +02:00
#define SLC_DEBUG
2024-09-14 12:54:22 +02:00
#include "engine/slc.h"
2024-09-26 12:32:58 +02:00
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++];
}
2024-09-14 12:54:22 +02:00
int main(int argc, const char **argv) {
// TODO: Implement CLI frontend...
puts("TODO: Implement CLI frontend...");
2024-09-26 12:32:58 +02:00
// 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
);
2024-09-14 12:54:22 +02:00
return 0;
}