summaryrefslogtreecommitdiff
path: root/parser.h
blob: 9c5cc716e9311d91290414df7afb787809bbdb34 (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
30
#ifndef PARSER_H
#define PARSER_H

#include <stdint.h>
#include <stddef.h>
#include "lexer.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