summaryrefslogtreecommitdiff
path: root/parser.h
blob: 4c750cf23ca9c85721a35bb6d41d6a53cdd47601 (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
29
#ifndef PARSER_H
#define PARSER_H

#include <stdint.h>
#include <stddef.h>

typedef enum {
	NODE_START,
	NODE_RETURN,
	NODE_CONST,
} node_type;

typedef struct _node {
	union {
		uint64_t integer;
		double flt;
	} data;

	node_type type;
	struct _node **children;
	size_t children_length;
	size_t children_size;
	size_t id;
} node;

void add_child(node *n, node *child);
node *ir_parse(token *tokens);

#endif