An Automatic "Visitor" Generator for Ada Martin C. Carlisle Department of Computer Science 2354 Fairchild Dr., Suite 1J133 US Air Force Academy, CO 80840 c a r l is I e m @ a c m , o r g Ricky E. Sward Department of Computer Science 2354 Fairchild Dr., Suite 1J134 US Air Force Academy, CO 80840 1 Introduction This paper describes work that has been done to automatically generate code that implements the Visitor design pattern for a specified grammar. This work is an extension of the work done on the Ada Generator of Object-Oriented Parsers (AdaGOOP) [Car00]. AdaGOOP creates lexer and parser specifications automatically given a specific grammar. The lexer and parser specifications include all methods needed to generate the parse tree. Our work extends AdaGOOP by automatically including the code for visitor objects that can perform operations on the parse tree generated by AdaGOOP. This paper first describes the Visitor design pattern and the benefits of implementing this pattern, then describes the AdaGOOP tool in more detail and how the tool was extended to automatically generate visitor objects. Finally, we present examples of the visitor objects generated by AdaGOOP. 2 Visitor Design Pattern Implementing
/lp/association-for-computing-machinery/an-automatic-visitor-generator-for-ada-sewyEM70m8