#include #include #include #include "util.h" #include "lexer.h" int main(int argc, char **argv) { /* Омогућава библиотекама коришћеним у интерпретеру да протумаче српску ћирилицу */ if (setlocale(LC_ALL, "sr_RS.utf8") == NULL) { fprintf(stderr, "locale couldn't be set to \"sr_RS.utf8\", check if you've enabled it on your system\n"); exit(0); } while (1) { char *input = readline("Л> "); if (input == NULL) { putchar('\n'); printf("Крај улазног тока.\n"); // Превод exit(0); } token *tokenList, *current; current = tokenList = lexLine(input); int i = 0; while (current != NULL) { printf("Токен бр. %d: \"%s\", тип:%s\n", i, current->lexeme, current->type == number ? "number" : (current->type == symbol ? "symbol" : "parenthesis")); } free(input); } }