aboutsummaryrefslogtreecommitdiff
path: root/interpreter/graphs.h
blob: 07ca66339260e2f7d79c5f8cd73b3cbd55a468cd (plain) (blame)
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
#ifndef _H_GRAPHS
#define _H_GRAPHS

#include "syntax.h"

struct node {
	expr_kind kind;
	void* var1;
	void* var2;
	unsigned int used_count;
};

typedef struct {
	unsigned int length;
	struct node* nodes[1];
} nodes_array;

void use_node(struct node* node, unsigned int count);
void free_node(struct node* node, unsigned free_first);

nodes_array* push_node(nodes_array* nodes, struct node* node);

void cpy_expression_to_node(struct node* dst, expression* src);
void cpy_node_to_expression(expression* dst, struct node* src);

#endif