summaryrefslogtreecommitdiff
path: root/tree.h
blob: 8353a6d40a01749bf9d38dad1b828a399a787fda (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
#ifndef TREE_H_HG
#define TREE_H_HG

enum nodeType {
  BIOP,
  UNOP,
  LTTR
};

typedef struct node {
  enum nodeType type;
  char el;
	union {
		struct node *child[2];
		struct {
			struct node *lhs, *rhs;
		};
		struct node *value;
	};
} node;

node * parse(char *str);
void printTree(node *root, int level);

#endif