public Table(List <Oper> opers, List <Element> ter, List <Element> brack, Element br) { operations = opers; terms = ter; brackets = brack; brake = br; var merge = terms.Append(brake).Concat(brackets).Concat(opers); elements = merge.ToList(); int size = elements.Count; relations = new Relat[size][]; for (int i = 0; i < size; i++) { relations[i] = new Relat[size]; var firEl = elements[i]; for (int j = 0; j < size; j++) { var secEl = elements[j]; if (isOperation(firEl)) { var firOp = (Oper)firEl; if (isOperation(secEl)) { var secOp = (Oper)secEl; if (secOp.Unar) { relations[i][j] = Relat.Lesser; } else if (firOp.Prior > secOp.Prior) { relations[i][j] = Relat.More; } else if (firOp.Prior < secOp.Prior) { relations[i][j] = Relat.Lesser; } else if (firOp.LAssoc) { relations[i][j] = Relat.More; } else if (!firOp.LAssoc) { relations[i][j] = Relat.Lesser; } else { relations[i][j] = Relat.None; } } else if (isTerm(secEl) || isLeftBracket(secEl)) { relations[i][j] = Relat.Lesser; } else if (isRightBracket(secEl) || secEl == brake) { relations[i][j] = Relat.More; } else { relations[i][j] = Relat.None; } } else if (isTerm(firEl)) { if (isOperation(secEl) || isRightBracket(secEl) || secEl == brake) { relations[i][j] = Relat.More; } else { relations[i][j] = Relat.None; } } else if (firEl.Name == "(") { if (isOperation(secEl) || secEl.Name == "(" || isTerm(secEl) || secEl.Name == "[") { relations[i][j] = Relat.Lesser; } else if (secEl.Name == ")") { relations[i][j] = Relat.Equal; } else { relations[i][j] = Relat.None; } } else if (firEl.Name == "[") { if (isOperation(secEl) || secEl.Name == "(" || isTerm(secEl) || secEl.Name == "[") { relations[i][j] = Relat.Lesser; } else if (secEl.Name == "]") { relations[i][j] = Relat.Equal; } else { relations[i][j] = Relat.None; } } else if (isRightBracket(firEl)) { if (isOperation(secEl) || secEl.Name == ")" || secEl == brake || secEl.Name == "]") { relations[i][j] = Relat.More; } else { relations[i][j] = Relat.None; } } else if (firEl == brake) { if (isOperation(secEl) || isLeftBracket(secEl) || isTerm(secEl)) { relations[i][j] = Relat.Lesser; } else { relations[i][j] = Relat.None; } } else { relations[i][j] = Relat.None; } } } }