wip parser structure with placeholders

This commit is contained in:
hugogogo
2026-05-01 01:58:04 +02:00
parent 512ba9b5f4
commit 241cbdaff1
4 changed files with 122 additions and 8 deletions

View File

@@ -4,22 +4,37 @@
#include "libft.h"
#include "lexer.h"
#include "errors.h"
#include <stdbool.h>
typedef enum
{
TERM_LEFT, // a in "a = b"
TERM_RIGHT, // b in "a = b"
} term_type;
} term_position;
typedef enum
{
TERM_PLUS, // +
TERM_MINUS, // -
} term_sign;
typedef enum
{
TYPE_INT, // "123"
TYPE_DOUBLE, // "123.456"
} coefficient_type;
typedef struct
{
term_type type;
term_position position;
term_sign sign;
coefficient_type coefficient_type;
union
{
char value_char;
int value_int;
double value_double;
int coefficient_int;
double coefficient_double;
};
int exponent;
} term;
int parse(token *tokens, term *terms);