summaryrefslogtreecommitdiff
path: root/src/runtime/c/gfcc-tree.h
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2009-12-13 18:50:29 +0000
committerkrasimir <krasimir@chalmers.se>2009-12-13 18:50:29 +0000
commitf85232947e74ee7ef8c7b0ad2338212e7e68f1be (patch)
tree667b886a5e3a4b026a63d4e3597f32497d824761 /src/runtime/c/gfcc-tree.h
parentd88a865faff59c98fc91556ff8700b10ee5f2df8 (diff)
reorganize the directories under src, and rescue the JavaScript interpreter from deprecated
Diffstat (limited to 'src/runtime/c/gfcc-tree.h')
-rw-r--r--src/runtime/c/gfcc-tree.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/runtime/c/gfcc-tree.h b/src/runtime/c/gfcc-tree.h
new file mode 100644
index 000000000..cc8f0fcab
--- /dev/null
+++ b/src/runtime/c/gfcc-tree.h
@@ -0,0 +1,49 @@
+#ifndef GFCC_TREE_H
+#define GFCC_TREE_H
+
+typedef enum {
+ ATOM_STRING,
+ ATOM_INTEGER,
+ ATOM_DOUBLE,
+ ATOM_META,
+ ATOM_FIRST_FUN
+} atom_type;
+
+struct Tree_{
+ atom_type type;
+ union {
+ const char *string_value;
+ int integer_value;
+ double double_value;
+ int size;
+ } value;
+ struct Tree_ *args[0];
+};
+
+typedef struct Tree_ Tree;
+
+static inline Tree *tree_get_child(Tree *t, int n) {
+ return t->args[n];
+}
+
+static inline void tree_set_child(Tree *t, int n, Tree *a) {
+ t->args[n] = a;
+}
+
+extern int arity(Tree *t);
+
+
+extern Tree *tree_string(const char *s);
+
+extern Tree *tree_integer(int i);
+
+extern Tree *tree_double(double d);
+
+extern Tree *tree_meta();
+
+extern Tree *tree_fun(atom_type f, int n);
+
+
+extern void tree_free(Tree *t);
+
+#endif