Create expression struct and memory pool
This commit is contained in:
27
lib/include/expression.h
Normal file
27
lib/include/expression.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef EXPRESSION_H
|
||||
#define EXPRESSION_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef enum {
|
||||
OPERATOR_ADD,
|
||||
OPERATOR_SUBTRACT,
|
||||
OPERATOR_MULTIPLY,
|
||||
OPERATOR_DIVIDE,
|
||||
} operator_t;
|
||||
|
||||
struct _expression_t;
|
||||
typedef struct {
|
||||
operator_t operator;
|
||||
const struct _expression_t *operands[2];
|
||||
} application_t;
|
||||
|
||||
typedef struct _expression_t {
|
||||
bool is_number;
|
||||
union {
|
||||
application_t application;
|
||||
int number;
|
||||
};
|
||||
} expression_t;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user