// CLASS DICTIONARY //========================================================== // solving the capacity checking problem from hw 2 // without modifying the host // visitor has own stack to keep track of initial value // is also an exercise with Java wrapper classes (Integer). // package RecursiveContainer; import edu.neu.ccs.demeter.dj.*; // no concept of subpackages in Java import java.util.*; Container = "(" List(Item) Capacity ")" . Item : Container | Simple. List(S) ~ {S}. Simple = Ident Weight. Capacity = Integer. Weight = Integer. CheckingVisitorDJ = DifferenceVisitorDJ int extends Visitor. SummingVisitorDJ = int extends Visitor. DifferenceVisitorDJ = // takes care of computing difference int Stack SummingVisitorDJ extends Visitor. Main = .