scl/src/main.c

29 lines
664 B
C
Raw Normal View History

2024-09-28 09:31:23 -04:00
#include <stdio.h>
2024-10-13 23:46:03 -04:00
#include "include/dstr.h"
#include "include/util.h"
2024-10-07 11:48:53 -04:00
#include "include/lexer.h"
2024-09-28 09:31:23 -04:00
int main(int argc, char** argv) {
2024-10-13 23:46:03 -04:00
while(1) {
Dstr* cline = dstr_init(); // The current line.
printf("> ");
fflush(stdout);
2024-10-16 08:13:32 -04:00
for (char cch; (cch = getc(stdin)) != '\n';) {
log_dbgf("cchar: %c", cch);
dstr_appendch(cline, cch);
2024-10-13 23:46:03 -04:00
}
2024-10-07 11:48:53 -04:00
2024-10-16 08:13:32 -04:00
log_dbgf("cline: %s", cline->buf);
2024-10-13 23:46:03 -04:00
if (cline->ln > 0) {
Lexer* lexer = lexer_init(cline->buf);
lexer_lex(lexer);
lexer_print(lexer);
2024-10-31 16:44:17 -04:00
lexer_destroy(lexer);
2024-10-13 23:46:03 -04:00
}
2024-10-31 16:44:17 -04:00
dstr_destroy(cline);
2024-10-13 23:46:03 -04:00
}
2024-09-28 09:31:23 -04:00
}