anchor.diff:      let s = {lastList=0;c=c;out=out;out1=out1}
       s
   
  -type Ptrlist= State option list 
  -
  +type RewriteState=
  +    | State_out1 of State
  +    | State_out of State
   (*
    * A partially built NFA without the matching state filled in.
    * Frag.start points at the start state.
  
positive.code:         | '?' -> //zero or one 
              let e =pop()
              let s = state rs (Split, Some(e.start), None)
              push(frag(s, append(e.out, list1(s.out1))))
          | '*' ->
              let e = pop()
              let s = state rs (Split, Some(e.start), None)
              e.out <- patch(e.out, s)
              push(frag(s, list1(s.out1)))
          | '+' -> //one or more
              let e = pop()
              let s = state rs (Split, Some(e.start), None)
              e.out <- patch(e.out, s)
              push(frag(e.start, list1(s.out1)))
          | c -> //default
              let s = state rs (Char c, None, None)
              push(frag(s, list1(s.out)))
  
      let e = pop()
      if (stack.Count>0) then
          None
      else
          e.out <- patch(e.out, rs.matchstate)
          Some(e.start)
  
  type List=System.Collections.Generic.List<State>
  
negative.code:         out:Ptrlist
      }
  *)
  type Frag(start:State, out:RewriteState list)=
      member val start=start
      member val out=out with get,set
  
  (* Initialize Frag struct. *)
  let frag(start:State, out:RewriteState list)=
      let n=new Frag(start=start, out=out)
      n
  
  (* Create singleton list containing just outp. *)
  let list1 (outp:RewriteState) : RewriteState list= 
      [outp]
  (* Patch the list of states at out to point to start. *)
  let patch (list : RewriteState list, s: State) =
      list |> List.iter (fun next->
          match next with
          | State_out s'-> s'.out <- Some s
          | State_out1 s'-> s'.out1 <- Some s
      )
      ()
  
  (* Join the two lists l1 and l2, returning the combination. *)
  let append(l1,l2)= l1 @ l2
  
  (*
   * Convert postfix regular expression to NFA.
  