28 lines
463 B
C
28 lines
463 B
C
#ifndef PARSER_H
|
|
#define PARSER_H
|
|
|
|
typedef enum
|
|
{
|
|
TERM_LEFT, // a in "a = b"
|
|
TERM_RIGHT, // b in "a = b"
|
|
TERM_END, // last term
|
|
} term_position;
|
|
|
|
typedef enum
|
|
{
|
|
TERM_PLUS, // +
|
|
TERM_MINUS, // -
|
|
TERM_NULL, // null -> for the last term
|
|
} term_sign;
|
|
|
|
typedef struct
|
|
{
|
|
term_position position;
|
|
term_sign sign;
|
|
double coefficient;
|
|
double exponent;
|
|
} term;
|
|
|
|
int parse(token *tokens, term *terms, int terms_count_max);
|
|
|
|
#endif |