31 lines
466 B
C
31 lines
466 B
C
#ifndef PARSER_H
|
|
#define PARSER_H
|
|
|
|
#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_position;
|
|
|
|
typedef enum
|
|
{
|
|
TERM_PLUS, // +
|
|
TERM_MINUS, // -
|
|
} term_sign;
|
|
|
|
typedef struct
|
|
{
|
|
term_position position;
|
|
term_sign sign;
|
|
double coefficient;
|
|
int exponent;
|
|
} term;
|
|
|
|
int parse(token *tokens, term *terms, int terms_count_max);
|
|
|
|
#endif |