summaryrefslogtreecommitdiff
path: root/tree.h
blob: 8df9f5392a0c5c4e2a43ec636842eb2fd3ce9e44 (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
#ifndef TREE_H_HG
#define TREE_H_HG
#include <stdio.h>

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 fprintTree(FILE *stream, node *root, int level);
void printTree(node *root, int level);

#endif