anchor.diff:  
   let eol = System.Environment.NewLine
   
  -
  -let run grammarFile frontendName generatorName generatorParams conversions userDefs generateToFile =
  -    let frontend =
  -        let fen = (Addin.GetFrontends())
  -        let _raise () = InvalidFEName frontendName |> raise
  -        if Array.exists (fun (elem : Frontend) -> elem.Name = frontendName) (Addin.GetFrontends())
  -        then
  -            try
  -                match Array.tryFind (fun (elem : Frontend) -> elem.Name = frontendName) (Addin.GetFrontends()) with
  -                | Some fe -> fe
  -                | None -> failwith "Frontend is not found."
  -            with
  -            | _ -> _raise ()
  -        else _raise ()
  -
  -    // Parse grammar
  -    let ilTree =
  +let getFrontend frontendName =
  +    let fen = (Addin.GetFrontends())
  +    let _raise () = InvalidFEName frontendName |> raise
  +    if Array.exists (fun (elem : Frontend) -> elem.Name = frontendName) (Addin.GetFrontends())
  +    then
           try
  -            let defStr = String.concat ";" userDefs
  -            if System.String.IsNullOrEmpty defStr
  -            then grammarFile
  -            else grammarFile + "%" + defStr
  -            |> frontend.ParseGrammar
  -            |> ref
  +            match Array.tryFind (fun (elem : Frontend) -> elem.Name = frontendName) (Addin.GetFrontends()) with
  +            | Some fe -> fe
  +            | None -> failwith "Frontend is not found."
           with
  -        | e -> FEError (e.Message + " " + e.StackTrace) |> raise
  -    Namer.initNamer ilTree.Value.grammar
  -
  +        | _ -> _raise ()
  +    else _raise ()
  +
  +let getIlTreeFromFile grammarFile (frontend : Frontend) userDefs = 
  +    try
  +        let defStr = String.concat ";" userDefs
  +        if System.String.IsNullOrEmpty defStr
  +        then grammarFile
  +        else grammarFile + "%" + defStr
  +        |> frontend.ParseGrammar
  +        |> ref
  +    with
  +    | e -> FEError (e.Message + "\nFailed parsing grammar file: " + e.StackTrace) |> raise
  +
  +let getIlTreeFromStr grammarStr (frontend : Frontend) = 
  +    try
  +        ref (frontend.ParseGrammarFromStr grammarStr)
  +    with
  +    | e -> FEError (e.Message + "\nFailed parsing grammar string: " + e.StackTrace) |> raise
  +
  +let processErrors (errorList : (_ * 'a list) list) msg map delimiter =
  +    if errorList.Length > 0 then
  +        eprintfn  "%s" msg
  +        errorList |> List.iter (fun (m, rules) ->
  +            rules
  +            |> List.map map
  +            |> String.concat delimiter
  +            |> eprintfn "Module %s:%s%s" (getModuleName m) eol
  +        )
  +
  +let dealWithErrors ilTree = 
       let repeatedInnerRules, repeatedExportRules, undeclaredRules = GetUndeclaredNonterminalsList !ilTree
  -
  -    let processErrors (errorList : (_ * 'a list) list) msg map delimiter =
  -        if errorList.Length > 0 then
  -            eprintfn  "%s" msg
  -            errorList |> List.iter (fun (m,rules) ->
  -                rules
  -                |> List.map map
  -                |> String.concat delimiter
  -                |> eprintfn "Module %s:%s%s" (getModuleName m) eol
  -            )
  -                    
       processErrors undeclaredRules
           "Input grammar contains some undeclared nonterminals:"
           (fun rule -> sprintf "%s (%s:%d:%d)" rule.text rule.file rule.startPos.line rule.startPos.column)
  
positive.code:         (fun (rule, got, expected) -> sprintf "%s(%d,%d): %d (expected %d)" rule.text rule.startPos.line rule.startPos.column got expected)
          eol
  
      let lostSources = ref false
      // Let possible to know, after what conversion we lost reference to original code
      let checkSources name il = 
  
negative.code:                 x
                  |> List.map(fun s -> s.text) |> String.concat "\n"
                  |> printfn "Lost sources after frontend or conversion %s:\n %s" name
  
      checkSources frontend.Name !ilTree
      // Apply Conversions
      for conv in conversions do
          ilTree := applyConversion conv !ilTree
          checkSources conv !ilTree
  
  let gen grammarFile frontendName generatorName generatorParams conversions userDefs generateToFile = 
      try
          let frontend = getFrontend frontendName
          let ilTree = getIlTreeFromFile grammarFile frontend userDefs
          applyConversions ilTree frontend conversions
          let generator = prepareGenerator generatorName
          let checkedIl = checkIlTree ilTree generator
          if generateToFile then
              genToFile generator generatorParams checkedIl
          else
              genToObj generator generatorParams checkedIl
      with
      | InvalidFEName frontendName as e  -> 
          "Frontend with name " + frontendName + " is not available. Run \"Main.exe -af\" for get all available frontends.\n" 
  