c-repl/src/include/tokenize.h
2023-11-14 17:00:34 +01:00

34 lines
669 B
C++

#ifndef TOKENIZE_H
#define TOKENIZE_H
#include <vector>
#include <variant>
#include <string>
using namespace std;
enum class TokenType { Type, Identifier, Int, Plus, Minus, DoublePlus, DoubleMinus, Star, Slash, Percent, Equal, Semicolon, LParenthese, RParenthese };
enum class Type { Int };
using TokenData = variant<int, string, Type>;
struct Token {
TokenType type;
TokenData data { };
};
/*
Parses a string into a vector of tokens
*/
vector<Token> tokenize(string str);
/*
Format and print a Token
*/
void _debug_print_token(Token token);
/*
Formats a list of tokens and prints it
*/
void _debug_print_tokens(vector<Token> tokens);
#endif