hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/ast.h
blob: 1a6f15981b85b88d4dcdd09ddc8b3b1f00b1c273 (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
#pragma once

enum NodeKind
{
    NODE_CHAR,
    TYPE_DECLTYPE,
    VALUE_DIFFERENCE,
    STMT_EMIT
};

struct Node
{
    enum NodeKind kind;
    int line;
    char character;
    struct Node* first;
    struct Node* second;
    struct Node* next;
};

struct Node* node_leaf(enum NodeKind kind);
struct Node* node_char(char character);
struct Node* node_unary(enum NodeKind kind, struct Node* first);
struct Node* node_binary(enum NodeKind kind, struct Node* first, struct Node* second);

struct Node* node_append(struct Node* list, struct Node* node);
void node_free(struct Node* node);