33 lines
521 B
C

/*
* Copyright (c) Camden Dixie O'Brien
* SPDX-License-Identifier: AGPL-3.0-only
*/
#ifndef EXPRESSION_H
#define EXPRESSION_H
#include <stdbool.h>
typedef enum {
OPERATOR_ADD = 0,
OPERATOR_SUBTRACT = 1,
OPERATOR_MULTIPLY = 2,
OPERATOR_DIVIDE = 3,
} 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