Files
42_EXT_05_computorv1/headers/lexer.h
2026-04-29 12:41:19 +02:00

32 lines
624 B
C

#ifndef LEXER_H
#define LEXER_H
#include "../libft/includes/libft.h"
typedef enum
{
TOKEN_VARIABLE, // x, y, etc.
TOKEN_NUMBER_INT, // int
TOKEN_NUMBER_DOUBLE, // double
TOKEN_POWER, // ^ or **
TOKEN_PLUS, // +
TOKEN_MINUS, // -
TOKEN_MULTIPLICATION, // *
TOKEN_DIVISION, // /
TOKEN_END // null (end of input)
} token_type;
typedef struct
{
token_type type;
union
{
char value_char;
int value_int;
double value_double;
};
} token;
void lexerize(const char *input, token *tokens);
#endif