public override (Counter Initial, List <Transform> Transforms) VisitProgram(ChemsParser.ProgramContext context) { var initials = context.initial().token().GroupBy(tok => tok.GetText()).ToDictionary(ite => ite.Key, ite => ite.Count()); var counter = new Counter(initials); var rv = new RuleVisitor(); var transforms = context.rule().Select(rv.VisitRule).ToList(); return(counter, transforms); }