private void WriteLoop(string cond, int m, int n)
{
if (m == 1 && n == 1) //case: r{1,1} = r
Write(cond);
else if (m == 0 && n == 1) //case: ?
Write(string.Format("(re-option {0})",cond));
else if (m == 0 && n == int.MaxValue) //case: *
Write(string.Format("(re-star {0})",cond));
else if (m == 1 && n == int.MaxValue) //case: +
Write(string.Format("(re-plus {0})",cond));
else if (n == int.MaxValue) //case {m,}
Write(string.Format("(re-concat ((_ re-loop {0} {0}) {1}) (re-star {1}))", m, cond));
else //case {m,n}
Write(string.Format("((_ re-loop {0} {1}) {2})", m, n, cond));
}