2024-09-28 09:31:23 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2024-10-13 23:46:03 -04:00
|
|
|
#include "include/dstr.h"
|
2024-09-30 09:00:37 -04:00
|
|
|
#include "include/util.h"
|
2024-10-07 11:48:53 -04:00
|
|
|
#include "include/lexer.h"
|
2024-09-30 09:00:37 -04:00
|
|
|
|
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) {
|
2024-11-07 19:41:14 -05:00
|
|
|
lexer_init(cline->buf);
|
|
|
|
lexer_lex();
|
|
|
|
lexer_print();
|
|
|
|
lexer_destroy();
|
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
|
|
|
}
|