split files

This commit is contained in:
hugogogo
2026-04-28 22:35:46 +02:00
parent 48221894c0
commit fb81f200d9
7 changed files with 127 additions and 104 deletions

31
headers/lexer.h Normal file
View File

@@ -0,0 +1,31 @@
#ifndef LEXER_H
#define LEXER_H
#include "../libft/includes/libft.h"
typedef enum
{
TOKEN_PLUS, // +
TOKEN_MINUS, // -
TOKEN_VARIABLE, // x, y, etc.
TOKEN_NUMBER, // int or double
TOKEN_POWER, // ^ or **
TOKEN_MULTIPLICATION, // *
TOKEN_DIVISION, // /
TOKEN_END // null (end of input)
} token_type;
typedef struct
{
token_type type;
union
{
double num_value; // For NUMBER
char var_value; // For VARIABLE (single char, e.g., 'x')
};
} token;
#define MAX_TOKENS 100
int lexerize(const char *input, token tokens[MAX_TOKENS]);
#endif