summaryrefslogtreecommitdiff
path: root/myfind/ast_evaluation/expression.h
blob: d81718d4bd3bb12e03715d807949d2d0baacfc91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef EXPRESSION_H
#define EXPRESSION_H

enum my_expr_type
{
    EXPR_ADDITION = 0,
    EXPR_SUBTRACTION,
    EXPR_MULTIPLICATION,
    EXPR_DIVISION,
    EXPR_NEGATION,
    EXPR_NUMBER
};

struct my_expr
{
    enum my_expr_type type;
    union
    {
        struct
        {
            struct my_expr *left;
            struct my_expr *right;
        } children;
        int value;
    } data;
};

#endif /* ! EXPRESSION_H */