static void init_parser(void) { init_symbols(); init_first(); init_follow(); init_parsing_table(); }
int shell (int argc, char* args[]) { FILE* file = NULL; table = (void**)(vm_exec(NULL, NULL).ptr); gc_init(); new_func_data_table(); new_global_environment(); exception_init(); if (argc > 1){ file = fopen(args[1],"r"); if (!file) { EXCEPTION("Script not found!!\n"); exit(1); } } init_first(); set_static_mtds(); void *handler = dlopen("libreadline" K_OSDLLEXT, RTLD_LAZY); void *f = (handler != NULL) ? dlsym(handler, "readline") : NULL; myreadline = (f != NULL) ? (char* (*)(const char*))f : NULL; f = (handler != NULL) ? dlsym(handler, "add_history") : NULL; myadd_history = (f != NULL) ? (int (*)(const char*))f : _add_history; int i = 0; while (bootstrap_functions[i] != NULL) { split_and_exec(2, args, (char*)bootstrap_functions[i]); i++; } if (argc > 1){ shell_file(argc, args, file); } else { shell_readline(argc, args); } func_data_table_free(); opline_free(); gc_end(); return 0; }