summaryrefslogtreecommitdiff
path: root/comp/lucas-standen-NEA/code2/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'comp/lucas-standen-NEA/code2/debug.c')
-rw-r--r--comp/lucas-standen-NEA/code2/debug.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/comp/lucas-standen-NEA/code2/debug.c b/comp/lucas-standen-NEA/code2/debug.c
new file mode 100644
index 0000000..3d2d75b
--- /dev/null
+++ b/comp/lucas-standen-NEA/code2/debug.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include "tokenizer.h"
+
+#include "util.h"
+
+void printAST(astNode *head){
+ printf("\n>>>\nfunc: %s\n", head->func);
+ printf("args: ");
+ for (int i = 0; i < 8; i++){
+ if (head->children[i] == NULL && head->args[i] == NULL){
+ printf("<<<");
+ return;
+ }
+
+ if (head->args[i] != NULL){
+ printf("%s ", head->args[i]);
+ }
+ if (head->children[i] != NULL){
+ printAST(head->children[i]);
+ }
+
+ }
+ printf("\n");
+}