Use the visitor design pattern to create another example visitor class, say NumberCollector, which collects all numbers

Question:

Use the visitor design pattern to create another example visitor class, say NumberCollector, which collects all numbers that appear in the AST in a list. For example, three numbers, “3,” “4,” and “2,” appear in the AST of the program “(+ 3 4 2).” The methods in NumberCollector also should not use any global or static variables. The NumberCollector class should not have any fields.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: