public static IList<IParseTree> Descendants(IParseTree t) { List<IParseTree> nodes = new List<IParseTree>(); nodes.Add(t); int n = t.ChildCount; for (int i = 0; i < n; i++) { nodes.AddRange(Descendants(t.GetChild(i))); } return nodes; }