slc/main.c
2024-09-29 02:08:52 +02:00

83 lines
1.8 KiB
C

#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, slc_tmp_charptr key, symptr ptr) {
symptr ret;
ret.worp = NULL;
return ret;
// TODO: Create a "peasantly" symbol table where we have:
// - 32 length
// - 32 previndex
// - 32 nextindex
// - char* name inline stored
// - padding (divisible by 4)
//
// Then I can do a lookup basically via strstr-like (but 4byte steps!)
// with first few characters zero-padded in the search term parameter
// and if you want check extra validity by jumping back&forth in it.
}
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 to push(42); print\n"
"/*#push(21)\n"
"#push(21)\n"
"#add*/\n"
" #push(42)\n"
" #print\n"
"\n"
"#: word_test\n"
" #push(21)\n"
" #push(21)\n"
" #add\n"
" #print\n"
"\n"
"word_test\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;
}