refactor: spread across files
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#define NOB_IMPLEMENTATION
|
||||
#include "lisp.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argc < 2)
|
||||
return 1;
|
||||
|
||||
argv++;
|
||||
const char *line = *argv++;
|
||||
Nob_String_View view = nob_sv_from_cstr(line);
|
||||
|
||||
Tokens tokens = {0};
|
||||
tokenize(view, &tokens);
|
||||
|
||||
#if 0
|
||||
for (size_t i = 0; i < tokens.count; i++) {
|
||||
Token tok = tokens.items[i];
|
||||
printf("Token(kind=%s, data=" SV_Fmt ")\n", token_kind_name(tok.kind),
|
||||
SV_Arg(tok.data));
|
||||
}
|
||||
#endif
|
||||
|
||||
Node *result = parse(&tokens);
|
||||
if (result == NULL)
|
||||
return 1;
|
||||
|
||||
result = eval(result);
|
||||
node_print(*result);
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user