anchor.diff:          | :? int as x when x < 0 -> Unchecked.defaultof<_>, true
           | _ -> failwith "Strange tree - singleNode with non-negative value"
   
  -    member this.Root = root
  -    member this.RulesCount = rules.GetLength(0)
  -
  -  
  -
       member this.AstToDot (indToString : int -> string) tokenToNumber (leftSide : array<int>) (path : string) =
  -        
  -        let nodeToNumber = new System.Collections.Hashtable({new Collections.IEqualityComparer with
  -                                                                    override this.Equals (x1, x2) = Object.ReferenceEquals (x1, x2)
  -                                                                    override this.GetHashCode x = x.GetHashCode()})
           use out = new System.IO.StreamWriter (path : string)
           out.WriteLine("digraph AST {")
  +
           let createNode num isAmbiguous nodeType (str : string) =
               let label =
                   let cur = str.Replace("\n", "\\n").Replace ("\r", "")
  
positive.code:     val mutable first : 'T
      val mutable other : 'T[]
      new (f,o) = {first = f; other = o}
  
  /// Non-terminal expansion: production, family of children
  /// All nodes are stored in array, so there is a correspondence between integer and node.
  
negative.code:             let shape =
                  match nodeType with
                  | AstNode -> ",shape=box"
                  | FamilyNode -> ",shape=box"
                  | Terminal -> ",shape=box"
                  | Intermidiate -> ",shape=oval"
              let color =
                  if not isAmbiguous then ""
                  else ",style=\"filled\",fillcolor=red"
              out.WriteLine ("    " + num.ToString() + " [label=\"" + label + "\"" + color + shape + "]")
  
          let createEdge (b : int) (e : int) isBold (str : string) =
              let label = str.Replace("\n", "\\n").Replace ("\r", "")
              let bold = 
                  if not isBold then ""
                  else "style=bold,width=10,"
              out.WriteLine ("    " + b.ToString() + " -> " + e.ToString() + " [" + bold + "label=\"" + label + "\"" + "]")
          
          let nodeQueue = new Queue<NumNode>()
          let used = new Dictionary<_,_>()
          let num = ref -1
          nodeQueue.Enqueue(new NumNode(!num, root))
          while nodeQueue.Count <> 0 do
              let currentPair = nodeQueue.Dequeue()
              let key = ref 0
              if !num <> -1
              then
  
                  if currentPair.Node <> null && used.TryGetValue(currentPair.Node, key)
                  then
                      createEdge currentPair.Num !key false ""
                  else    
                      num := !num + 1
                      used.Add(currentPair.Node, !num)
                      match currentPair.Node with 
                      | :? AST as a -> 
                     
                          createNode !num false AstNode (indToString leftSide.[a.first.prod])
                          createEdge currentPair.Num !num false ""
                          nodeQueue.Enqueue(new NumNode(!num, a.first))
                          if a.other <> Unchecked.defaultof<_> 
                          then 
                              for t in a.other do
                                  nodeQueue.Enqueue(new NumNode(!num, t))
                      | :? Family as f ->
                          createNode !num false FamilyNode ("fam " + indToString leftSide.[f.prod])
                          createEdge currentPair.Num !num false ""
                          nodeQueue.Enqueue(new NumNode(!num, f.node))
                      | :? IntermidiateNode as i ->
                          createNode !num false Intermidiate ((getRule i.Position).ToString() + " " + (getPosition i.Position).ToString())
                          createEdge currentPair.Num !num false ""
                          if i.LeftChild <> null then nodeQueue.Enqueue(new NumNode(!num, i.LeftChild))
                          if i.RightChild <> null then nodeQueue.Enqueue(new NumNode(!num, i.RightChild))
                      | :? TerminalNode as t ->
                          createNode !num false Terminal ("t " + indToString (tokenToNumber tokens.[t.value]))
                          createEdge currentPair.Num !num false ""
                      | null -> ()
              else
                  let a = currentPair.Node :?> AST
                  num := !num + 1
                  createNode !num false AstNode (indToString leftSide.[a.first.prod])
                  nodeQueue.Enqueue(new NumNode(!num, a.first))
                  if a.other <> Unchecked.defaultof<_> 
                  then 
                      for t in a.other do
                          nodeQueue.Enqueue(new NumNode(!num, t))
          
  
          out.WriteLine("}")
          out.Close()
  