anchor.diff:              |> List.fold (fun (accMeta, accRes) body ->
                   //printfn "%A" body
                   expandBody body module' metaRules expanded accRes
  -                |> (fun (newBody, newAccRes) ->
  -                    (newBody::accMeta, newAccRes)
  -                )
  +                |> fun (newBody, newAccRes) -> (newBody::accMeta, newAccRes)
               ) ([], resRuleList)
               |> applyToRes List.rev
           // TODO catch exception
  
positive.code:         | PSome body -> PSome <| replace body
          | POpt body  -> POpt  <| replace body
          | PMany body -> PMany <| replace body
          | PRef(name, attrs) as prev ->
              prev |> tryReplaceActual formalToAct (Source.toString name)
          | PAlt (l, r) -> PAlt(replace l, replace r)
          | PSeq (ruleList, actionCode, l) ->
              PSeq (ruleList |> List.map (fun x ->  {x with rule = replace x.rule})
                      , actionCode, l)
          | PLiteral _ as literal -> literal
          | PToken _ as token -> token
          | PMetaRef (name, attrs, metaArgs) -> 
              if metaArgs.IsEmpty then
                  PRef(name, attrs) |> tryReplaceActual formalToAct (Source.toString name)
  
negative.code: /// if rule has metaArgs then it is a metarule
  let private isMetaRule (r:Rule.t<Source.t,Source.t>) = r.metaArgs <> []
  
  /// hash table for metarules. 
  /// Map: using_module -> (rule_name -> (decl_module, rule_body));
  let private metaRulesTbl grammar =
      let rulesMap = getRulesMap grammar
      let publicRules = new Dictionary<_,_>(getPublicRules grammar)
      /// Only public meta-rules present here
      let publicMeta =
          let map = new Dictionary<string,Rule.t<Source.t, Source.t> list>()
          publicRules |> Seq.iter (fun item ->
              map.[item.Key] <- List.filter isMetaRule item.Value
          )
          map
  
      grammar
      |> List.map (fun m ->
          let res = new Dictionary<_,_>()
          m.openings
          |> List.iter (fun op ->
              publicMeta.[op.text]
              |> List.iter (fun rule ->
                  res.[rule.name.text] <- (op.text, rule)
              )
          )
          m.rules
          |> List.filter isMetaRule
          |> List.iter (fun rule ->
              res.[rule.name.text] <- (getModuleName m, rule)
          )
          getModuleName m, res
      )
      |> dict
  
  (** grammar processing:
   *  - collect metarules
  