One solution would be to only pass the compiler as the argument and have it produce the tree itself since I only care about parse trees atm.