summaryrefslogtreecommitdiff
path: root/src/core/interpret.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/interpret.c')
-rw-r--r--src/core/interpret.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/core/interpret.c b/src/core/interpret.c
new file mode 100644
index 0000000..bbb238c
--- /dev/null
+++ b/src/core/interpret.c
@@ -0,0 +1,19 @@
+#include "interpret.h"
+#include "tokenizer.h"
+
+#include <stdbool.h>
+
+SandInterpretResult sand_interpret(SandState *S, const char *filename, const char *source, size_t source_length) {
+ SandTokenizer tokenizer = sand_create_tokenizer(source, source_length, filename);
+
+ while (true) {
+ SandToken token = sand_get_next_token(&tokenizer);
+ sand_print_location(stdout, &token.location);
+ printf(": %s \"%.*s\"\n", sand_token_kind_to_string(token.kind), (int)token.content_length, token.content);
+ if (token.kind == SAND_TOKEN_EOF) {
+ break;
+ }
+ }
+
+ return SAND_INTERPRET_OK;
+}