private static void AddNode(SppfNode node, List<ForestNode[]> startList, Sentence rhs, int position) {
ForestNode nodeToAdd;
if (node is TerminalNode) {
nodeToAdd = new ForestLeaf((TerminalNode)node);
} else {
nodeToAdd = new ForestInternal((SymbolNode)node, (Nonterminal)rhs[position]);
}
foreach (var children in startList) {
children[position] = nodeToAdd;
}
}