// This code sums the values of all assets and all liabilities. SymbolTable { traversal allAttribs (GetAttributeVisitor) { to {Symbol,Asset,Liability}; } } GetAttributeVisitor { {{ double assets; double liabilities; boolean isAsset; boolean isLiability; }} public double getAssets() {{ return assets; }} public double getLiabilities() {{ return liabilities; }} before SymbolTable {{ assets = 0; liabilities = 0; }} before Symbol {{ isAsset = false; isLiability = false; }} before Asset {{ isAsset = true; }} before Liability {{ isLiability = true; }} after Symbol {{ if (isAsset) { assets += host.getValue(); } else if (isLiability) { liabilities += host.getValue(); } }} }