Applying Crary and Weirich to Adaptive Programming in Functional Style a la Shriram and Mitch =============================================================== Example: Finding free variables in a Scheme-like program. What is the complexity of the following method: In class Program: List freeVariables(ClassGraph cg, String strategy) { return (List) cg.traverse(this, strategy, new FreeVariablesVisitor()); } Questions: Do your "Resource Bound Certification" techniques apply here? The program is very generic: we don't know the class graph (to be constructed by reflection) and we don't know the strategy. How does the running time of the program depend on the structure of the class graph and the strategy? import edu.neu.ccs.demeter.dj.*; import java.util.*; import edu.neu.ccs.demeter.*; class FreeVariablesVisitor extends FunctionVisitor { Object combine(Object[] values) { if(values.length==0) return null; if(values[0] != null && values[0] instanceof Hashtable) { Hashtable h=(Hashtable) values[0]; for(int i=1;i *,tail,* to edu.neu.ccs.demeter.Ident",cg); System.out.println(" check free variables "); FunctionalOGS fogs=new FunctionalOGS(p,allWeights); List l=(List)fogs.traverse(new FreeVariablesVisitor()); for(int i=0; i 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} . Input: =========================== begin let x=0 y= proc(x,y) begin x+y; end in begin x+y; end; end