summaryrefslogtreecommitdiff
path: root/comp/lucas-standen-NEA/code2/debug.c
blob: 14b717f23f63860fe1297299412ca48d641f1d5e (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
#include <stdio.h>
#include "tokenizer.h"

#include "util.h"

//# a simple util function to visulize an astNode, never used but nice for debugging
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");
}