summaryrefslogtreecommitdiff
path: root/tree.h
diff options
context:
space:
mode:
Diffstat (limited to 'tree.h')
-rw-r--r--tree.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/tree.h b/tree.h
index a58d270..8353a6d 100644
--- a/tree.h
+++ b/tree.h
@@ -1,3 +1,6 @@
+#ifndef TREE_H_HG
+#define TREE_H_HG
+
enum nodeType {
BIOP,
UNOP,
@@ -7,7 +10,16 @@ enum nodeType {
typedef struct node {
enum nodeType type;
char el;
- struct node *child[2];
+ 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