Implement visitor pattern to allow serialization of AST to string for easier testing