[Compiler-sig] AST observations

Finn Bock bckfnn@worldonline.dk
Fri, 19 Apr 2002 14:41:37 GMT


[Jeremy]

>It might be clearer to merge the walker and the visitor into a single
>class using inheritance.  (I think the Walkabout variant described by
>Palsberg and Jay does this,
>    cf. http://citeseer.nj.nec.com/palsberg97essence.html.)

Yes, and so does the the Visitor pattern they describe in 2.3. Based on
the performance measurement in chapter 4, at least I hope you understand
why I argue for a static double dispatch Visitor instead of a dynamic
dispatching Walkabout pattern. The added flexibility of dynamic dispatch
is pure YAGNI for me. Since I can control the code generated for each
AST node, it would be plain wrong not to add an 'accept' method.

regards,
finn