gemstone/src/main.c

48 lines
787 B
C
Raw Normal View History

2024-05-08 20:10:14 +00:00
#include <ast/ast.h>
#include <stdlib.h>
#include <sys/log.h>
2024-05-13 14:13:49 +00:00
#include <sys/col.h>
#include <lex/util.h>
#include <io/files.h>
#include <compiler.h>
2024-04-26 14:21:54 +00:00
2024-04-12 15:29:39 +00:00
/**
* @brief Log a debug message to inform about beginning exit procedures
2024-05-07 11:04:22 +00:00
*
2024-04-12 15:29:39 +00:00
*/
2024-05-08 20:10:14 +00:00
void notify_exit(void) { DEBUG("Exiting gemstone..."); }
2024-04-12 15:29:39 +00:00
/**
* @brief Run compiler setup here
2024-05-07 11:04:22 +00:00
*
2024-04-12 15:29:39 +00:00
*/
2024-05-08 20:10:14 +00:00
void setup(void) {
// setup preample
2024-04-12 15:29:39 +00:00
log_init();
DEBUG("starting gemstone...");
2024-05-07 11:04:22 +00:00
#if LOG_LEVEL <= LOG_LEVEL_DEBUG
atexit(&notify_exit);
2024-05-07 11:04:22 +00:00
#endif
// actual setup
AST_init();
2024-05-07 11:04:22 +00:00
col_init();
2024-05-13 14:13:49 +00:00
lex_init();
2024-05-13 14:13:49 +00:00
DEBUG("finished starting up gemstone...");
}
2024-05-31 19:25:37 +00:00
int main(int argc, char *argv[]) {
setup();
print_message(Info, "Running GSC version %s", GSC_VERSION);
run_compiler(argc - 1, &argv[1]);
return 0;
2024-05-08 20:10:14 +00:00
}