COM 3362 Aspect-Oriented Software Development Karl Lieberherr Winter 2002 Homework 8 Functional Visitors in DJ prepared with Pengcheng Wu Due March 5, 2002 DJ is an AOP tool for programming of traversal-related conerns directly in Java. Pengcheng Wu added a new capablility: Functional Visitors. Documentation: http://www.ccs.neu.edu/home/lieber/com1205/w01/materials/html/fv.htm /proj/adaptive3/wupc/html/fv.htm See: /proj/adaptive/www/related-work/rice/shriram project-proposal for motivation. Use functional visitors to solve the following problem: Program = NodeList . Node : lookahead (@ 2 @) AppNode | LetNode | lookahead (@ 2 @) AssignNode | look ahead (@ 2 @) AddNode| Term | ProcNode . LetNode = "let" Bindings "in" NodeList . AddNode = Term "+" Term . Term : VarNode | LitNode . VarNode = Ident . LitNode = int . ProcNode = "proc" "(" [ FormalParameters ] ")" NodeList . AppNode = Ident "(" [ ActualParameters ] ")" . AssignNode = Ident "=" Node . Bindings = List(Binding) . Binding = Ident "=" Node . FormalParameters = NList(FormalParameter) . FormalParameter = Ident . ActualParameters = NList(ActualParameter) . ActualParameter = Node . NodeList = "begin" List(Statement) "end" . Statement = Node ";" . NList(S) ~ S {"," S} . List(S) ~ {S} . Write a program that stores at each node in the abstract syntax tree the set of free variables. Add a caching aspect similar to hw 4. Reuse a version of Qian Yi's abstract aspects that are based on two interfaces. Her code is in: /proj/demeter/lieber/courses/com3362/w02/hw/4/solution/qianyi/part1-d