#include #include #include #include "vm.h" #include "lexer.h" static const char* strs[] = { "whitespace", "identifier", "keyword", "operator", "separator", "integer", "string", "function_start", "function_end", "expression_start", "expression_end" }; int main(int argc, char** argv) { lexer_tokens* tokens = lexer_analyze("int foo = \"hi there\""); size_t i; for (i = 0; i < tokens->length; ++i) { lexer_token pair = tokens->pairs[i]; char* str = malloc(pair.len); memcpy(str, pair.str, pair.len); str[pair.len - 1] = '\0'; printf("class: %s, str: %s\n", strs[pair.tokenClass], str); } }