看看《编译原理》,其中有相关的算法描述

解决方案 »

  1.   

    if your expressions are not complicated, try
    using System;
    using System.Text.RegularExpressions; string s="((a1+a2)*a3-a4)/a5";
    string[] sList = s.Split(new char[]{'(',')','+','-','*','/'});
    foreach (string str in sList)
    Console.WriteLine("***{0}**",str); s="(( a1 + a2)*a3-a4)/a5";
    sList = Regex.Split(s, @"\s*[-+*/()]+\s*");
    foreach (string str in sList)
    Console.WriteLine("***{0}**",str);