锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚久久调教视频,91久久精品国产91性色,欧美丝袜一区二区http://www.shnenglu.com/lwch/category/14952.html銆怮Q:510134884銆戙怑mail:<a href="mailto:lwch748@gmail.com">lwch748@gmail.com</a>銆?/description>zh-cnWed, 16 Oct 2013 19:25:17 GMTWed, 16 Oct 2013 19:25:17 GMT60QParserGenerator鐨勬枃娉曟枃浠朵粙緇?/title><link>http://www.shnenglu.com/lwch/archive/2013/10/09/203576.html</link><dc:creator>lwch</dc:creator><author>lwch</author><pubDate>Wed, 09 Oct 2013 03:17:00 GMT</pubDate><guid>http://www.shnenglu.com/lwch/archive/2013/10/09/203576.html</guid><wfw:comment>http://www.shnenglu.com/lwch/comments/203576.html</wfw:comment><comments>http://www.shnenglu.com/lwch/archive/2013/10/09/203576.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/lwch/comments/commentRss/203576.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/lwch/services/trackbacks/203576.html</trackback:ping><description><![CDATA[鍦ㄦ矇榛樹簡鏁版湀涔嬪悗錛屽崥涓誨績琛鏉ユ疆鎯崇戶緇粙緇峇ParserGenerator錛屽湪榪欓噷鎴戜滑灝嗕笉鍐嶇戶緇粙緇嶄換浣曟湁鍏充簬LALR(1)鐨勭畻娉?閭d笢瑗垮彧浼氭妸浣犵殑鑴戝瓙鍙樻垚涓鍥㈡祮緋?錛岃鎴戜滑鏉ョ湅涓涓婹ParserGenerator鐨勫叿浣撶敤娉曘?br /> <br /> 璇村埌ParserGenerator涓嶅緱涓嶆彁鐨勬槸BNF錛屽簲姝ParserGenerator涔熸湁瀹冭嚜宸辯殑BNF錛岃繖鏃舵湁浜轟細闂瓸NF絀剁珶鏄粈涔堝憿錛熺畝鍗曠殑璇碆NF灝辨槸鐢ㄦ潵鎻忚堪涓縐嶈娉曠殑涓滆タ錛屾瘮濡傚湪Basic涓璉f鍚庨潰璺熻〃杈懼紡鐒跺悗鏄疶hen涓棿鏄鍙ュ潡鏈熬蹇呴』瑕佹湁End If絳夌瓑鐨勪竴緋誨垪鎻忚堪錛屾洿涓撲笟鐨勮В閲婃垜浠彲浠ョ湅涓涓?a target="_blank">緇村熀鐧劇</a>涓婄殑瑙i噴銆?br /> <br /> 濂戒簡錛岃瀹屼簡BNF閭h鎴戜滑鏉ョ湅涓涓婹ParserGenerator鐨凚NF鍒板簳鏄暱鍟ユ牱鐨?br /> <div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> -->%token "%" "token" "start" "|" "-" ">" ";" "[" "]";<br /> <br /> %start start;<br /> <br /> strings             -> strings "{String}"<br />                     |  "{String}"<br />                     ;<br /> <br /> vs                  -> vs "{Letter}"<br />                     |  vs "{String}"<br />                     |  "{Letter}"<br />                     |  "{String}"<br />                     ;<br /> <br /> option              -> "[" vs "]"<br />                     ;<br /> <br /> oneProductionRight  -> oneProductionRight option<br />                     |  oneProductionRight vs<br />                     |  option<br />                     |  vs<br />                     ;<br /> <br /> someProductionRight -> someProductionRight "|" oneProductionRight<br />                     |  oneProductionRight<br />                     ;<br /> <br /> token               -> "%" "token" strings ";"<br />                     ;<br /> <br /> someTokens          -> someTokens token<br />                     |  token<br />                     ;<br /> <br /> production          -> "{Letter}" "-" ">" someProductionRight ";"<br />                     ;<br /> <br /> someProductions     -> someProductions production<br />                     |  production<br />                     ;<br /> <br /> start               -> someTokens "%" "start" "{Letter}" ";" someProductions<br />                     |  "%" "start" "{Letter}" ";" someProductions<br />                     ;</div> 涔熻鏈変漢浼氶棶錛屼笉瀵瑰晩鏍規嵁<a target="_blank">緇村熀鐧劇</a>涓婄殑璇存槑BNF涓嶅簲璇ユ槸闀胯繖鏍風殑錛屽叾瀹濹ParserGenerator鏄竴涓狟NF鐨勭敓鎴愬櫒錛屽畠鍙互灝嗚緭鍏ョ殑BNF閫氳繃涓緋誨垪鐨勮繍綆楁渶鍚庣敓鎴怢ALR(1)鍒嗘瀽琛紝涓轟簡BNF鏂囦歡鐨勭編瑙傚拰鏂逛究澶勭悊鎴戠壒鍦版妸浠栬璁℃垚浜嗚繖涓牱瀛愮殑鑰屽凡錛屽ソ浜嗕笅闈㈡垜浠氨浠ヨ繖涓狟NF鏂囦歡鏉ヨ鏄庡簲璇ュ浣曟潵涔﹀啓BNF鏂囦歡銆?br /> <br /> 棣栧厛鍙互鐪嬪埌鏈欏朵笂鏈変竴浜涗互%token寮澶寸殑瀛楃涓詫紙鍦–璇█涓垜浠皢鐢ㄥ弻寮曞彿鎷搗鏉ョ殑瀛楃搴忓垪縐頒負瀛楃涓詫級浠ュ強鏈鍚庣殑涓涓垎鍙鳳紝鍏跺疄榪欓噷鐨勮繖浜涘瓧絎︿覆姝f槸BNF涓璇寸殑緇堢粨絎︼紝鎵浠ユ垜浠瀹氾紝鎵鏈夊叾浠栨病鐢?token澹版槑鐨勭鍙烽兘鏄潪緇堢粨絎︺傜粓緇撶鏄敤鏉ュ仛縐昏繘鎿嶄綔鐨勶紝鍦ㄦ煇縐嶇壒瀹氱殑璇█涓粬琛ㄧ幇涓轟竴涓猼oken錛岃岄潪緇堢粨絎﹀彲浠ョ悊瑙d負涓涓唬璇嶏紝閫氬父涓涓潪緇堢粨絎﹂兘鍙互灞曞紑涓轟竴鏉℃垨澶氭潯瑙勫垯錛?a target="_blank">浜х敓寮?/a>錛夈傝嚦浜庤涓轟粈涔堟瘡鏉″唴瀹瑰悗闈㈤兘浼氭湁鍒嗗彿鍛紝鍙槸涓轟簡澶勭悊涓婄殑鏂逛究錛堟秷闄よ娉曚笂鐨勫啿紿侊紵錛夈?br /> 濂戒簡錛屾垜浠妸緇堢粨絎﹀拰闈炵粓緇撶榪欎袱涓笓涓氭湳璇粰瑙i噴瀹屼簡錛屾帴涓嬫潵鍙互鐪嬪埌鐨勬槸涓涓互%start寮澶村悗璺熶竴涓潪緇堢粨絎︾殑璇彞錛屼粬琛ㄦ槑浜嗘墍鏈夎鍒欙紙<a target="_blank">浜х敓寮?/a>錛夋槸浠庡摢閲屽紑濮嬬殑錛堟湁濮嬫棤緇堢殑鑺傚-_-||鏉叿鍟婏級銆?br /> <br /> 鏈鍚庡氨鏄垜浠殑閲嶅ご浜嗭紝澶氱┖涓琛屼篃涓嶄負榪囧惂銆傝繖閲屾湁涓澶у爢鐨勪駭鐢熷紡錛岄偅鎴戜滑濡備綍鏉ラ槄璇諱粬鍛紝鍏跺疄涓婇潰宸茬粡浠嬬粛浜嗘湁涓〃鏄庝簡鎵鏈夎鍒欏紑澶寸殑闈炵粓緇撶錛屽ソ閭h鎴戜滑鏉ユ壘涓涓嬩粬鎵瀵瑰簲鐨勪駭鐢熷紡鍦ㄥ摢閲?br /> <div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> -->start               -> someTokens "%" "start" "{Letter}" ";" someProductions<br />                     |  "%" "start" "{Letter}" ";" someProductions<br />                     ;</div> 鍙互鐪嬪埌鎵鏈夌殑瑙勫垯鍙垎涓哄乏鍗婇儴鍒嗗拰鍙沖崐閮ㄥ垎錛屽乏杈規繪槸涓涓潪緇堢粨絎︽潵璇存槑浠栧簲璇ヨ鍝竴浜涜鍒欐潵鏇夸唬錛岃屽彸杈瑰垯鏄繖浜涜鍒欑殑鍏蜂綋鍐呭鍖呭惈浜嗕竴浜涚粓緇撶鍜岄潪緇堢粨絎﹀簭鍒楋紝涓棿鍒欑敤涓涓澶寸鍙鋒潵鍒嗗壊銆傚湪鎵鏈夌殑瑙勫垯涓潪緇堢粨絎﹂兘鏄笉甯﹀紩鍙風殑錛岃岀粓緇撶閮芥槸鐢ㄥ紩鍙峰皢鍏舵嫭璧鋒潵鐨勶紝鍦ㄧ粓緇撶涓湁涓浜涘唴緗殑鍙橀噺鏉ヨ〃杈句竴浜涚壒瀹氱殑琛ㄨ揪寮忥紝榪欎釜浼氬湪涓嬫枃涓仛鍑鴻鏄庛傚綋鐒跺浜庡悓涓涓粓緇撶鏉ヨ鎴戜滑鍙互鐢ㄤ換鎰忓涓鍒欐潵璇存槑浠栵紝浠栦滑閮芥槸<font color="red">鎴?/font>鐨勫叧緋伙紝鐢變簬BNF涓笉鍙兘瀛樺湪<font color="red">涓?/font>鐨勫叧緋伙紝搴旀鎴戜滑騫朵笉闇瑕佽冭檻浠栥?br /> <br /> 涓嬮潰璁╂垜浠潵鐪嬩竴涓嬮瀹氫箟鐨勭粓緇撶鏈夊摢浜涳紝浠?a target="_blank">Parser.cpp</a>鐨勪唬鐮佷腑鍙煡棰勫畾涔夌殑緇堢粨絎︽湁"{String}"銆?{Digit}"銆?{Real}"銆?{Letter}"銆?br /> "{String}"錛氳〃紺烘鍒欒〃杈懼紡\"[^\"]*\"<br /> "{Digit}"錛氳〃紺烘鍒欒〃杈懼紡[0-9]+<br /> "{Real}"錛氳〃紺烘鍒欒〃杈懼紡[0-9]*.[0-9]+<br /> "{Letter}"錛氳〃紺烘鍒欒〃杈懼紡((_[0-9]+)|([_a-zA-Z]+))[_0-9a-zA-Z]*<br /> 浠庤繖浜涙鍒欒〃杈懼紡涓彲瑙?{String}"琛ㄧず涓涓甫鍙屽紩鍙風殑瀛楃涓詫紝"{Digit}"鍒欒〃紺轟竴涓暟瀛楋紝"{Real}"鍒欒〃紺轟竴涓誕鐐規暟錛?{Letter}"鍒欒〃紺轟竴涓笉甯﹀弻寮曞彿鐨勫瓧絎︿覆銆傚綋鐒惰繖浜涙鍒欒〃杈懼紡鍐欑殑騫朵笉瀹屽錛屾瘮濡?{String}"涓病鏈夋敮鎸佽漿涔夌瓑絳夈?br /> <br /> 鐒跺悗璁╂垜浠潵鐪嬩竴涓嬫瘡鏉¤鍒欐敮鎸佸摢浜涜娉曪紝棣栧厛浠庝笅闈㈠嚑鏉℃枃娉曚腑鍙煡錛屽彲鐢ㄦ柟鎷彿灝嗕竴浜涘彲閫夐」鎷搗鏉ャ?br /> <div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #008080; ">1</span> vs                  -> vs "{Letter}"<br /> <span style="color: #008080; ">2</span>                     |  vs "{String}"<br /> <span style="color: #008080; ">3</span>                     |  "{Letter}"<br /> <span style="color: #008080; ">4</span>                     |  "{String}"<br /> <span style="color: #008080; ">5</span>                     ;<br /> <span style="color: #008080; ">6</span> <br /> <span style="color: #008080; ">7</span> option              -> "[" vs "]"<br /> <span style="color: #008080; ">8</span>                     ;</div> <br /> 鑰屽浜庝竴涓鍒欐潵璇翠粬鍙互鐢ㄨ嫢騫叉潯浜х敓寮忔潵璇存槑浠栵紝鍏朵腑姣忔潯浜х敓寮忎箣闂存槸<font color="red">鎴?/font>鐨勫叧緋匯?br /> <div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #008080; ">1</span> oneProductionRight  -> oneProductionRight option<br /> <span style="color: #008080; ">2</span>                     |  oneProductionRight vs<br /> <span style="color: #008080; ">3</span>                     |  option<br /> <span style="color: #008080; ">4</span>                     |  vs<br /> <span style="color: #008080; ">5</span>                     ;<br /> <span style="color: #008080; ">6</span> <br /> <span style="color: #008080; ">7</span> someProductionRight -> someProductionRight "|" oneProductionRight<br /> <span style="color: #008080; ">8</span>                     |  oneProductionRight<br /> <span style="color: #008080; ">9</span>                     ;</div> <br /> 鍏朵粬涓浜涜鍒欏垯璇存槑浜嗕竴浜涗笂鏂囨彁鍒扮殑瑙勫垯錛屾瘮濡傚紑澶存槸涓浜泃oken鐨勫畾涔夌瓑銆傜粓浜庢妸QParserGenerator鐨勬枃娉曟枃浠剁殑緇撴瀯緇欎粙緇嶅畬浜嗭紝鍦ㄦ帴涓嬫潵鐨勪竴綃囨枃绔犱腑鎴戜滑灝嗕粙緇嶅浣曠敤QParserGenerator鏉ョ敓鎴愪竴涓甫鎷彿浼樺厛綰х殑鍥涘垯娣峰悎榪愮畻璁$畻鍣紝鍏舵枃娉曞彲瑙?a target="_blank">Calculator.txt</a>錛孮Language鏁翠釜欏圭洰鐨勪唬鐮佸彲瑙?a target="_blank">https://github.com/lwch/QLanguage/</a>銆?img src ="http://www.shnenglu.com/lwch/aggbug/203576.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/lwch/" target="_blank">lwch</a> 2013-10-09 11:17 <a href="http://www.shnenglu.com/lwch/archive/2013/10/09/203576.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>QParserGenerator浠g爜鍒嗘瀽浜?A fix&An example)http://www.shnenglu.com/lwch/archive/2013/05/30/200608.htmllwchlwchThu, 30 May 2013 15:04:00 GMThttp://www.shnenglu.com/lwch/archive/2013/05/30/200608.htmlhttp://www.shnenglu.com/lwch/comments/200608.htmlhttp://www.shnenglu.com/lwch/archive/2013/05/30/200608.html#Feedback2http://www.shnenglu.com/lwch/comments/commentRss/200608.htmlhttp://www.shnenglu.com/lwch/services/trackbacks/200608.html涓婁竴綃?/a>錛岄鍏堥渶瑕佷慨姝g殑鏄湪DFA鐢熸垚綆楁硶涓殑浼犳挱閮ㄥ垎錛屽簲璇ラ渶瑕佹湁涓驚鐜竴鐩翠紶鎾埌涓嶈兘浼犳挱涓烘錛屽湪澶氭瀹為獙涓〃鏄庯紝鏈変簺灞曟湜絎︽槸閫氳繃絎?錛?錛?鐢氳嚦鏇村嬈′紶鎾緱鏉ョ殑銆?br />
搴旀錛岀浉搴旂殑make鍑芥暟鍙樻垚浜?br />
    bool LALR1::make()
    {
        vector<LALR1Production> v;
        v.push_back(inputProductions[begin][0]);
        pStart = closure(v);
        pStart->idx = Item::inc();
        context.states.insert(pStart);
        items.push_back(pStart);

        queue<Item*> q;
        q.push(pStart);

        vector<Item*> changes;

        bool bContinue = false;
        while (!q.empty())
        {
            Item* pItem = q.front();
            vector<Production::Item> s;
            symbols(pItem, s);
            select_into(s, vts, compare_production_item_is_vt, push_back_unique_vector<Production::Item>);
            select_into(s, vns, compare_production_item_is_vn, push_back_unique_vector<Production::Item>);
            for (vector<Production::Item>::const_iterator i = s.begin(), m = s.end(); i != m; ++i)
            {
                Item* pNewItem = NULL;
                if (go(pItem, *i, pNewItem))
                {
                    long n = itemIndex(pNewItem);
                    if (n == -1)
                    {
                        pNewItem->idx = Item::inc();
                        q.push(pNewItem);
                        items.push_back(pNewItem);
                        context.states.insert(pNewItem);
                    }
                    else
                    {
                        items[n]->mergeWildCards(pNewItem, bContinue);
                        changes.push_back_unique(items[n]);
                        destruct(pNewItem, has_destruct(*pNewItem));
                        Item_Alloc::deallocate(pNewItem);
                    }
                    edges[pItem].push_back_unique(Edge(pItem, n == -1 ? pNewItem : items[n], *i));
                }
            }
            q.pop();
        }
        while (bContinue)
        {
            vector<Item*> v;
            v.reserve(changes.size());
            bContinue = false;
            for (vector<Item*>::const_iterator i = changes.begin(), m = changes.end(); i != m; ++i)
            {
                vector<Production::Item> s;
                symbols(*i, s);
                for (vector<Production::Item>::const_iterator j = s.begin(), n = s.end(); j != n; ++j)
                {
                    Item* pNewItem = NULL;
                    if (go(*i, *j, pNewItem))
                    {
                        long n = itemIndex(pNewItem);
                        if (n == -1) throw error<const char*>("unknown item", __FILE__, __LINE__);
                        else
                        {
                            items[n]->mergeWildCards(pNewItem, bContinue);
                            v.push_back_unique(items[n]);
                            destruct(pNewItem, has_destruct(*pNewItem));
                            Item_Alloc::deallocate(pNewItem);
                        }
                    }
                }
            }
            changes = v;
        }
    }
鍦╩erge鍑芥暟涓紝浼氭嫻嬫湁娌℃湁鏂扮敓鎴愮殑灞曟湜絎︽潵鍐沖畾鏄惁緇х畫浼犳挱涓嬪幓銆?br />
涓涓ず渚?/strong>
涓嬮潰鎴戜滑鐢ㄤ竴涓緥瀛愭潵璇存槑LALR1 DFA鏄浣曠敓鎴愮殑錛岄鍏堝畠鐨勬枃娉曞涓?br />
S -> L "=" R
  | R "+"
  | R
  ;

L -> "*" R
  |  "id"
  ;

R -> L
  ;
鏍規嵁涔嬪墠鐨勭畻娉曪紝鎴戜滑鍏堟潵鐪嬭嚜鐢熺殑閮ㄥ垎

棣栧厛鎴戜滑鍐欏嚭榪欎釜鏂囨硶鐨勫騫挎枃娉?br />
begin -> . S (#)
姹傚彇瀹冪殑闂寘寰楀埌
begin -> . S
wildCards:

S -> . L "=" R
wildCards:

S -> . R "+"
wildCards:

S -> . R
wildCards:

L -> . "*" R
wildCards:
"=" "+" 
L -> . "id"
wildCards:
"=" "+" 
R -> . L
wildCards:
"+" # 
鎴戜滑瑙傚療鍒幫紝鍏朵腑鏈?涓彲杞Щ鐨勭鍙鳳紝鍒嗗埆涓篠銆丩銆丷銆?*"鍜?id"錛屾垜浠垎鍒敤go鍑芥暟瀵硅繖5涓漿縐葷鍙鋒眰鍑烘柊鐨勭姸鎬?br />
棣栧厛鐢ㄧ鍙稴姹傚嚭鏂扮姸鎬?br />
begin -> S
wildCards:
鐢變簬榪欎釜鐘舵佷笉鍦ㄥ師鏈夊垪琛ㄤ腑錛屽簲姝ゅ畠鏄竴涓柊鐢熸垚鐨勭姸鎬侊紝鎴戜滑涓哄畠娣誨姞涓鏉¢氳繃絎﹀彿S杞Щ鐨勮竟銆?br />
鎺ヤ笅鏉ョ敤絎﹀彿L姹傚嚭鏂扮姸鎬?br />
S -> L . "=" R
wildCards:

R -> L
wildCards:
"+" # 
榪欎釜鐘舵佷篃涓嶅湪鍘熸湁鍒楄〃涓紝搴旀瀹冧篃鏄竴涓柊鐢熸垚鐨勭姸鎬侊紝鎴戜滑涓哄畠娣誨姞涓鏉¢氳繃絎﹀彿L杞Щ鐨勮竟銆?br />
鐒跺悗鐢ㄧ鍙稲姹傚嚭鏂扮姸鎬?br />
S -> R . "+"
wildCards:

S -> R
wildCards:
榪欎釜鐘舵佷篃涓嶅湪鍘熸湁鍒楄〃涓紝搴旀瀹冧篃鏄竴涓柊鐢熸垚鐨勭姸鎬侊紝鎴戜滑涓哄畠娣誨姞涓鏉¢氳繃絎﹀彿R杞Щ鐨勮竟銆?br />
鐒跺悗鐢ㄧ鍙?姹傚嚭鏂扮殑鐘舵?br />
L -> "*" . R
wildCards:
"=" "+" 
R -> . L
wildCards:
"+" # "=" 
L -> . "*" R
wildCards:
"=" "+" # 
L -> . "id"
wildCards:
"=" "+" # 
鍚屾牱鐨勫畠涔熶笉鍦ㄥ師鏈夌殑鍒楄〃涓紝鎴戜滑鍚屾牱涓哄叾娣誨姞涓鏉¢氳繃絎﹀彿*杞Щ鐨勮竟銆?br />
鐒跺悗鏄鍙穒d鐨?br />
L -> "id"
wildCards:
"=" "+" 
鍚屾牱涓嶅湪鍒楄〃涓紝鎴戜滑涓哄叾娣誨姞涓鏉¢氳繃絎﹀彿id杞Щ鐨勮竟銆?br />
榪欐牱錛屼粠start鐘舵佽漿縐誨嚭鏉ョ殑5鏉¤竟灝辯敓鎴愬ソ浜嗭紝涓嬮潰鏉ョ湅鐪嬭繖5涓柊鐢熸垚鐨勭姸鎬佸張浼氱敓鎴愪竴浜涗粈涔堝憿
begin -> S
wildCards:
鐢辯涓涓姸鎬佸彲鐭ワ紝瀹冩病鏈変換浣曠殑杈廣?br />
S -> L . "=" R
wildCards:

R -> L
wildCards:
"+" # 
絎簩涓姸鎬佸垯鏈変竴涓?鐨勮漿縐伙紝瀹冪敓鎴愪簡涓涓柊鐘舵?br />
S -> L "=" . R
wildCards:

R -> . L
wildCards:
"+" # "=" 
L -> . "*" R
wildCards:
"=" "+" # 
L -> . "id"
wildCards:
"=" "+" # 

S -> R . "+"
wildCards:

S -> R
wildCards:
絎笁涓姸鎬佹湁涓涓?鐨勮漿縐伙紝瀹冪敓鎴愪簡涓涓柊鐘舵?br />
S -> R "+"
wildCards:

L -> "*" . R
wildCards:
"=" "+" 
R -> . L
wildCards:
"+" # "=" 
L -> . "*" R
wildCards:
"=" "+" # 
L -> . "id"
wildCards:
"=" "+" # 
絎洓涓姸鎬佹湁4涓漿縐伙紝鍒嗗埆涓篟銆丩銆?鍜宨d

1.閫氳繃絎﹀彿R杞Щ鍒版柊鐘舵?br />
L -> "*" R
wildCards:
"=" "+" 

2.閫氳繃絎﹀彿L杞Щ鍒版柊鐘舵?br />
R -> L
wildCards:
"+" # "=" 

3.閫氳繃*鍒欏彲杞Щ鍒板畠鑷繁

4.閫氳繃id杞Щ鍒扮5涓姸鎬?br />
絎簲涓姸鎬佸垯娌℃湁浠諱綍鐨勮漿縐匯?br />
S -> L "=" . R
wildCards:

R -> . L
wildCards:
"+" # "=" 
L -> . "*" R
wildCards:
"=" "+" # 
L -> . "id"
wildCards:
"=" "+" # 
絎叚涓姸鎬佹湁4涓漿縐伙紝鍒嗗埆涓篟銆丩銆?鍜宨d

1.閫氳繃絎﹀彿R鍙漿縐誨埌鏂扮姸鎬?br />
S -> L "=" R
wildCards:

2.閫氳繃絎﹀彿L鍙漿縐誨埌鐘舵?

3.閫氳繃絎﹀彿*鍙漿縐誨埌鐘舵?

4.閫氳繃絎﹀彿id鍙漿縐誨埌鐘舵?

絎?銆?銆?涓姸鎬侀兘娌℃湁浠諱綍杞Щ

鐒跺悗璁╂垜浠潵鐪嬩笅changes鍒楄〃閲屾湁鍝簺涓滆タ錛屾牴鎹?a href="http://www.shnenglu.com/lwch/archive/2013/05/12/200203.html" target="_blank">涓婁竴綃?/a>鐨勭畻娉曞彲鐭ワ紝鎵鏈夊凡瀛樺湪鐨勭姸鎬侀兘鍦╟hanges鍒楄〃閲岋紝搴旀瀹冮噷闈㈠簲璇ヤ細鏈?銆?鍜?涓変釜鐘舵併?br />
鑷蟲錛屾暣涓嚜鐢熺殑閮ㄥ垎瀹屾垚浜嗭紝涓嬮潰鎴戜滑灝嗗叾鐢繪垚涓寮犲浘


涓嬮潰鏄紶鎾儴鍒?/strong>
鍦ㄧ涓嬈′紶鎾椂changes鍒楄〃閲屾湁3涓姸鎬侊紝鍒嗗埆瀵硅繖3涓姸鎬佺敤go鍑芥暟姹傚嚭鏂扮殑灞曟湜絎︼紝騫舵妸瀹冧滑鍚堝茍鍒板師鏈夌殑鐘舵佷笂銆?br />
棣栧厛鐪嬬姸鎬?錛屽畠鏈?涓姸鎬佽漿縐葷錛屽垎鍒槸R銆丩銆?鍜宨d

1.閫氳繃絎﹀彿R鍙漿縐誨埌鐘舵?錛屽悓鏃跺畠鐨勫睍鏈涚濡備笅
L -> "*" R
wildCards:
"=" "+" # 

2.閫氳繃絎﹀彿L鍙漿縐誨埌鐘舵?錛屽悓鏃跺畠鐨勫睍鏈涚濡備笅
R -> L
wildCards:
"+" # "=" 

3.閫氳繃絎﹀彿*鍙漿縐誨埌瀹冭嚜宸憋紝鍚屾椂瀹冪殑灞曟湜絎﹀涓?br />
L -> "*" . R
wildCards:
"=" "+" # 
R -> . L
wildCards:
"+" # "=" 
L -> . "*" R
wildCards:
"=" "+" # 
L -> . "id"
wildCards:
"=" "+" # 

4.閫氳繃絎﹀彿id鍙漿縐誨埌鐘舵?錛屽悓鏃跺畠鐨勫睍鏈涚濡備笅
L -> "id"
wildCards:
"=" "+" # 

鐒跺悗鎴戜滑鏉ョ湅涓涓嬬姸鎬?鍜?錛屽畠浠病鏈変換浣曠姸鎬佽漿縐葷錛屽簲姝ゅ畠浠笉浼氫紶鎾換浣曞睍鏈涚銆?br />
鐜板湪changes鍒楄〃閲屾湁4涓姸鎬侊紝鍒嗗埆涓?銆?銆?鍜?錛屽張鐢變簬絎?涓姸鎬佸凡緇忎駭鐢熶簡鏂扮殑灞曟湜絎?搴旀闇瑕佺戶緇紶鎾?br />
絎簩嬈′紶鎾?/strong>

棣栧厛鍏堢湅鐘舵?鍜?錛屽畠浠病鏈変換浣曠姸鎬佽漿縐葷錛屽簲姝ゅ畠浠笉浼氫紶鎾換浣曞睍鏈涚銆?br />
鐒跺悗鏉ョ湅鐘舵?錛屽悓鏍風殑瀹冩湁4涓姸鎬佽漿縐葷錛屽垎鍒負R銆丩銆?鍜宨d銆?br />
1.閫氳繃絎﹀彿R鍙漿縐誨埌鐘舵?錛屽悓鏃跺畠鐨勫睍鏈涚濡備笅
L -> "*" R
wildCards:
"=" "+" # 

2.閫氳繃絎﹀彿L鍙漿縐誨埌鐘舵?錛屽悓鏃跺畠鐨勫睍鏈涚濡備笅
R -> L
wildCards:
"+" # "=" 

3.閫氳繃絎﹀彿*鍙漿縐誨埌瀹冭嚜宸憋紝鍚屾椂瀹冪殑灞曟湜絎﹀涓?br />
L -> "*" . R
wildCards:
"=" "+" # 
R -> . L
wildCards:
"+" # "=" 
L -> . "*" R
wildCards:
"=" "+" # 
L -> . "id"
wildCards:
"=" "+" # 

4.閫氳繃絎﹀彿id鍙漿縐誨埌鐘舵?錛屽悓鏃跺畠鐨勫睍鏈涚濡備笅
L -> "id"
wildCards:
"=" "+" # 

鏈鍚庢垜浠潵鐪嬬姸鎬?錛屽畠娌℃湁浠諱綍鐘舵佽漿縐葷錛屽簲姝ゅ畠涓嶄細浼犳挱浠諱綍灞曟湜絎︺?br />
鐜板湪changes鍒楄〃閲屽悓鏍鋒湁4涓姸鎬侊紝鍒嗗埆涓?銆?銆?鍜?錛岀敱浜庢病鏈変竴涓姸鎬佷駭鐢熶簡鏂扮殑灞曟湜絎︼紝搴旀瀹冨皢涓嶄細緇х畫浼犳挱涓嬪幓浜嗐?br />
鐜板湪鏁翠釜鏂囨硶鐨凞FA灝辯敓鎴愬畬姣曚簡錛岃鎴戜滑鏉ヤ慨鏀逛竴涓嬪師鍏堢殑閭e紶鍥炬潵鐪嬬湅鏈緇堢殑DFA鏄粈涔堟牱鐨勩?br />

鏁翠釜紺轟緥灝卞厛浠嬬粛鍒拌繖閲岋紝鍦ㄦ帴涓嬫潵鐨勪竴綃囨枃绔犱腑灝嗕細閫氳繃鍑犱釜紺轟緥鏉ヤ粙緇峜losure鍜実o鍑芥暟鐨勫師鐞嗭紝甯屾湜榪欑鐢辯矖鍒扮粏鐨勮瑙i『搴忚兘澶熻璇昏呮墍鎺ュ彈銆傛渶鍚庡畬鏁寸殑浠g爜鍙埌http://code.google.com/p/qlanguage涓嬭澆銆?img src ="http://www.shnenglu.com/lwch/aggbug/200608.html" width = "1" height = "1" />

lwch 2013-05-30 23:04 鍙戣〃璇勮
]]>
QParserGenerator浠g爜鍒嗘瀽涓(鐢熸垚LALR1 DFA)http://www.shnenglu.com/lwch/archive/2013/05/12/200203.htmllwchlwchSun, 12 May 2013 14:32:00 GMThttp://www.shnenglu.com/lwch/archive/2013/05/12/200203.htmlhttp://www.shnenglu.com/lwch/comments/200203.htmlhttp://www.shnenglu.com/lwch/archive/2013/05/12/200203.html#Feedback1http://www.shnenglu.com/lwch/comments/commentRss/200203.htmlhttp://www.shnenglu.com/lwch/services/trackbacks/200203.htmlstrings     &n...  闃呰鍏ㄦ枃

lwch 2013-05-12 22:32 鍙戣〃璇勮
]]>
璇嶆硶鍒嗘瀽鍣?(&epsilon;-NFA鍒癉FA鐨勮漿鎹?http://www.shnenglu.com/lwch/archive/2013/02/23/198043.htmllwchlwchSat, 23 Feb 2013 15:30:00 GMThttp://www.shnenglu.com/lwch/archive/2013/02/23/198043.htmlhttp://www.shnenglu.com/lwch/comments/198043.htmlhttp://www.shnenglu.com/lwch/archive/2013/02/23/198043.html#Feedback0http://www.shnenglu.com/lwch/comments/commentRss/198043.htmlhttp://www.shnenglu.com/lwch/services/trackbacks/198043.html鎺?a href="http://www.shnenglu.com/lwch/archive/2013/02/15/197848.html" target="_blank">涓婁竴綃?/a>鎴戜滑宸茬粡寰楀埌浜嗕竴涓畬鏁寸殑ε-NFA錛屼笅闈㈡潵璇磋濡備綍灝?#949;-NFA杞崲涓篋FA錛堢‘瀹氭湁闄愯嚜鍔ㄦ満錛夈?/p>

DFA鐨勭姸鎬?/h1>

鍦―FA涓紝鏌愪釜鐘舵佸搴斿埌ε-NFA涓殑鑻ュ共鐘舵侊紝搴旀鎴戜滑灝嗕細寰楀埌涓嬮潰榪欐牱鐨勪竴涓粨鏋勩?/p>

 

 

        struct DFA_State
        {
            set<EpsilonNFA_State*> content;
            bool                   bFlag;
#ifdef _DEBUG
            uint                   idx;
#endif

            DFA_State(const set<EpsilonNFA_State*>& x) : content(x), bFlag(false)
            {
#ifdef _DEBUG
                idx = inc();
#endif
            }

            inline const bool operator==(const DFA_State& x)const
            {
                if (&x == this) return true;

                return content == x.content;
            }

#ifdef _DEBUG
            inline uint inc()
            {
                static uint i = 0;
                return i++;
            }
#endif
        };

 

鍙互鐪嬪埌錛屼負浜嗚皟璇曟柟渚挎垜浠湪緇撴瀯涓畾涔変簡鐘舵佺殑鍞竴ID浠ュ強瀵瑰簲鍒?#949;-NFA鐘舵佺殑闆嗗悎鍜屼竴涓爣璁頒綅銆?/p>

DFA鐨勮竟

鏍規嵁涓婁竴綃?/a>鐨勭粡楠岋紝涓嶉毦鎯沖埌DFA鐨勮竟搴旇鏄粈涔堟牱鐨勶紝涓嬮潰鐩存帴緇欏嚭浠g爜錛屼笉鍋氳鏄庛?/p>

 

        struct DFA_Edge
        {
            struct
            {
                Char_Type   char_value;
                String_Type string_value;
            }data;

            enum Edge_Type
            {
                TUnknown = 0,
                TNot     = 1,
                TChar    = 2,
                TString  = 4
            };

            uchar edge_type;

            DFA_State* pFrom;
            DFA_State* pTo;

            DFA_Edge(const Char_Type& x, bool bNot, DFA_State* pFrom, DFA_State* pTo) : pFrom(pFrom), pTo(pTo)
            {
                data.char_value = x;
                edge_type = bNot ? (TChar | TNot) : TChar;
            }

            DFA_Edge(const String_Type& x, bool bNot, DFA_State* pFrom, DFA_State* pTo) : pFrom(pFrom), pTo(pTo)
            {
                data.string_value = x;
                edge_type = bNot ? (TString | TNot) : TString;
            }

            inline const bool isNot()const
            {
                return (edge_type & TNot) == TNot;
            }

            inline const bool isChar()const
            {
                return (edge_type & TChar) == TChar;
            }

            inline const bool isString()const
            {
                return (edge_type & TString) == TString;
            }

            const Edge_Type edgeType()const
            {
                if (isChar()) return TChar;
                else if (isString()) return TString;
                else return TUnknown;
            }

            const bool operator<(const DFA_Edge& x)const
            {
                return (ulong)pFrom + pTo < (ulong)x.pFrom + x.pTo;
            }

            const bool operator==(const DFA_Edge& x)const
            {
                return pFrom == x.pFrom && pTo == x.pTo;
            }
        };

 

 

鐢變簬DFA涓笉瀛樺湪ε杈癸紝搴旀DFA灝嗕細瀛樺湪鑻ュ共涓粨鏉熺姸鎬侊紝浣嗕粬鍙湁涓涓紑濮嬬姸鎬?/p>

 

DFA_State*      pDFAStart;
set<DFA_State*> pDFAEnds;
set<DFA_Edge>   dfa_Edges;

 

 

涓轟簡涓嬩竴姝ュ垎鏋愮殑楂樻晥錛屼互鍚庡彲鑳戒細灝嗚繖閲岀殑dfa_Edges鍚屾牱淇敼涓篽ashmap銆?/p>

鑷蟲DFA鎵瑕佺敤鍒扮殑涓や釜緇撴瀯榪呴熺殑浠嬬粛瀹屼簡銆?/p>

瀛愰泦鏋勯犵畻娉?/h1>

閫氳繃鍚勭璧勬枡錛屾垜浠笉闅懼彂鐜幫紝浠?#949;-NFA杞崲鍒癉FA鐨勮繃紼嬩腑錛屾渶甯哥敤灝辨槸瀛愰泦鏋勯犵畻娉曘傚瓙闆嗘瀯閫犵畻娉曠殑涓昏鎬濇兂鏄?strong>璁〥FA鐨勬瘡涓姸鎬佸搴擭FA鐨勪竴涓姸鎬侀泦銆傝繖涓狣FA鐢ㄥ畠鐨勭姸鎬佸幓璁頒綇NFA鍦ㄨ杈撳叆絎﹀彿鍚庤揪鍒扮殑鎵鏈夌姸鎬併?/strong>錛堝紩鑷紪璇戝師鐞嗭級鍏剁畻娉曞涓?/p>

 

杈撳叆錛氫竴涓狽FA N銆?
杈撳嚭錛氫竴涓帴鍙楀悓鏍瘋璦鐨凞FA D銆?
鏂規硶錛?
1.姹傚彇ε-NFA鍒濆鐘舵佺殑ε闂寘浣滀負DFA鐨勮搗濮嬬姸鎬侊紝騫跺皢榪欎釜鐘舵佸姞鍏ラ泦鍚圕涓紝涓斿畠鏄湭鏍囪鐨勩傚悓鏃惰褰曞畠鐨勫悜鍚庡瓧絎﹂泦銆?
2.浠庨泦鍚圕涓彇鍑轟竴涓湭琚爣璁扮殑瀛愰泦T鍜屽叾瀵瑰簲鐨勫瓧絎﹂泦錛屾爣璁板瓙闆員銆?
3.浣跨敤涓婁竴姝ュ彇鍑虹殑瀛楃闆嗛氳繃鐘舵佽漿縐誨嚱鏁版眰鍑鴻漿縐誨悗鐨勭姸鎬侀泦M銆?
4.姹傚彇涓婁竴姝ュ緱鍒扮殑鐘舵侀泦M鐨?#949;闂寘U
5.濡傛灉U涓嶅湪闆嗗悎C涓垯灝哢浣滀負鏈鏍囪鐨勫瓙闆嗗姞鍏涓紝鍚屾椂璁板綍瀹冪殑鍚戝悗瀛楃闆嗐傛鏌ョ姸鎬乁涓槸鍚﹀瓨鍦∟FA涓殑緇堢粨鐘舵侊紝鑻ュ瓨鍦ㄥ垯灝嗙姸鎬乁鍔犲叆鍒皃DFAEnds涓?
閲嶅2錛?錛?錛?閮ㄧ洿鑷抽泦鍚圕涓笉瀛樺湪鏈鏍囪鐨勭姸鎬併?/pre>

ε闂寘

ε闂寘鏄寚浠庢煇涓姸鎬佽搗鍙粡榪?#949;杈硅揪鍒扮殑鍏朵粬鐘舵佺殑闆嗗悎錛屽悓鏃惰繖涓姸鎬佷篃灞炰簬榪欎釜闆嗗悎涓傚叾綆楁硶濡備笅

 

杈撳叆錛氱姸鎬侀泦k銆?
杈撳嚭錛氱姸鎬侀泦U鍜屽叾鎵瀵瑰簲鐨勫悜鍚庡瓧絎﹂泦銆?
鏂規硶錛?
1.閬嶅巻鐘舵侀泦k涓殑姣忎釜鐘舵乲'銆?
2.鑻'涓嶅瓨鍦ㄤ簬緇撴灉鐘舵侀泦U涓紝灝唊'鎻掑叆U涓?
3.寤虹珛涓涓復鏃墮泦鍚坱mp錛屽茍灝唊'鎻掑叆鍏朵腑銆?
4.浠庝復鏃墮泦鍚坱mp涓彇鍑轟竴涓姸鎬乸銆?
5.鍙栧嚭鎵鏈変粠p鍑哄彂鐨勮竟錛岃嫢榪欐潯杈規槸ε杈癸紝涓旀姷杈劇姸鎬佷笉鍦ㄧ粨鏋滅姸鎬侀泦U涓紝灝嗘姷杈劇殑鐘舵佸垎鍒彃鍏ョ粨鏋滅姸鎬侀泦U鍜屼復鏃墮泦鍚坱mp涓傝嫢榪欐潯杈規槸瀛楃闆嗙殑杈逛笖榪欐潯杈規墍瀵瑰簲鐨勫瓧絎︿笉鍦ㄥ悜鍚庡瓧絎﹂泦涓紝鍒欏皢鍚戝悗瀛楃鎻掑叆鍚戝悗瀛楃闆嗕腑銆?
6.灝嗙姸鎬乸浠庝復鏃墮泦鍚坱mp涓垹闄ゃ?
寰幆4錛?錛?閮ㄧ洿鑷硉mp涓笉瀛樺湪浠諱綍鐘舵佷負姝€?/pre>

 

 

鐢變簬鍦ㄧ敓鎴?#949;-NFA鏃朵笉瀛樺湪鍙湁ε杈圭殑寰幆錛屽簲姝よ繖閲屼笉浼氫駭鐢熸寰幆銆備笅闈㈢粰鍑哄叿浣撶殑浠g爜

 

        void epsilonClosure(const set<EpsilonNFA_State*>& k, EpsilonClosureInfo& info)
        {
            for (typename set<EpsilonNFA_State*>::const_iterator i = k.begin(), m = k.end(); i != m; ++i)
            {
                info.states.insert(*i);
                set<EpsilonNFA_State*> tmp;
                tmp.insert(*i);
                while (!tmp.empty())
                {
                    EpsilonNFA_State* pState = *tmp.begin();
                    for (typename vector<EpsilonNFA_Edge>::const_iterator j = epsilonNFA_Edges[pState].begin(), n = epsilonNFA_Edges[pState].end(); j != n; ++j)
                    {
                        if (j->isEpsilon())
                        {
                            if (info.states.insert(j->pTo).second) tmp.insert(j->pTo);
                        }
                        else if (j->isChar()) info.chars.insert(pair<Char_Type, bool>(j->data.char_value, j->isNot()));
                        else if (j->isString()) info.strings.insert(pair<String_Type, bool>(j->data.string_value, j->isNot()));
                    }
                    tmp.erase(pState);
                }
            }
        }

 

 

鍏朵腑鐢ㄥ埌鐨凟psilonClosureInfo緇撴瀯涓?/p>

 

        struct EpsilonClosureInfo
        {
            set<EpsilonNFA_State*>        states;
            set<pair<Char_Type, bool> >   chars;
            set<pair<String_Type, bool> > strings;

            EpsilonClosureInfo() {}

            EpsilonClosureInfo(const set<EpsilonNFA_State*>& states,
                               const set<pair<Char_Type, bool> >& chars,
                               const set<pair<String_Type, bool> >& strings)
                               : states(states)
                               , chars(chars)
                               , strings(strings) {}

            EpsilonClosureInfo(const EpsilonClosureInfo& x)
            {
                states  = x.states;
                chars   = x.chars;
                strings = x.strings;
            }
        };

 

闇瑕佷繚瀛樼殑鏄姸鎬侀泦鍜屽悜鍚庡瓧絎﹂泦銆?/p>

鐘舵佽漿縐誨嚱鏁?/h2>

閫氳繃鐘舵佽漿縐誨嚱鏁幫紝杈撳叆涓涓泦鍚圱鍜屼竴涓瓧絎灝嗗彲寰楀埌鎵鏈夐氳繃T涓殑姣忎竴涓姸鎬佸拰a杈規墍鑳借揪鍒扮殑鐘舵佺殑闆嗗悎銆傚簲姝や唬鐮佸涓?/p>

 

        set<EpsilonNFA_State*> move(const DFA_State& t, const Char_Type& c, bool bNot)
        {
            set<EpsilonNFA_State*> result;
            for (typename set<EpsilonNFA_State*>::const_iterator i = t.content.begin(), m = t.content.end(); i != m; ++i)
            {
                for (typename vector<EpsilonNFA_Edge>::const_iterator j = epsilonNFA_Edges[*i].begin(), n = epsilonNFA_Edges[*i].end(); j != n; ++j)
                {
                    if (j->isChar() && j->data.char_value == c && j->isNot() == bNot) result.insert(j->pTo);
                }
            }
            return result;
        }

        set<EpsilonNFA_State*> move(const DFA_State& t, const String_Type& s, bool bNot)
        {
            set<EpsilonNFA_State*> result;
            for (typename set<EpsilonNFA_State*>::const_iterator i = t.content.begin(), m = t.content.end(); i != m; ++i)
            {
                for (typename vector<EpsilonNFA_Edge>::const_iterator j = epsilonNFA_Edges[*i].begin(), n = epsilonNFA_Edges[*i].end(); j != n; ++j)
                {
                    if (j->isString() && j->data.string_value == s && j->isNot() == bNot) result.insert(j->pTo);
                }
            }
            return result;
        }

 

 

涓轟簡鍒嗗埆鏀寔Char_Type鍜孲tring_Type鐨勫瓧絎︽垜浠畾涔変簡涓や釜move鍑芥暟銆?/p>

鏈鍚庢垜浠粰鍑哄瓙闆嗘瀯閫犵畻娉曠殑浠g爜

 

        void buildDFA()
        {
            set<EpsilonNFA_State*> start;
            start.insert(pEpsilonStart);

            typedef pair<DFA_State*, EpsilonClosureInfo> c_type;

            map<size_t, list<c_type> > c;
            queue<c_type> c2;

            pDFAStart = DFA_State_Alloc::allocate();
            EpsilonClosureInfo info;
            epsilonClosure(start, info);
            construct(pDFAStart, info.states);

            c_type ct(pDFAStart, info);
            c[info.states.size()].push_back(ct);
            c2.push(ct);

            if (isEndDFAStatus(pDFAStart)) pDFAEnds.insert(pDFAStart);
            context.dfa_States.insert(pDFAStart);

            while (!c2.empty())
            {
                DFA_State* t = c2.front().first;
                set<pair<Char_Type, bool> > chars = c2.front().second.chars;
                set<pair<String_Type, bool> > strings = c2.front().second.strings;
                t->bFlag = true;

                for (typename set<pair<Char_Type, bool> >::const_iterator i = chars.begin(), m = chars.end(); i != m; ++i)
                {
                    EpsilonClosureInfo info;
                    epsilonClosure(move(*t, i->first, i->second), info);

                    DFA_State* p = getDFAState(info.states, c);
                    if (p) // 濡傛灉榪欎釜鐘舵佸凡瀛樺湪
                    {
                        dfa_Edges.insert(DFA_Edge(i->first, i->second, t, p));
                    }
                    else
                    {
                        DFA_State* pState = DFA_State_Alloc::allocate();
                        construct(pState, info.states);
                        context.dfa_States.insert(pState);

                        if (isEndDFAStatus(pState)) pDFAEnds.insert(pState);

                        c_type ct(pState, info);
                        c[info.states.size()].push_back(ct);
                        c2.push(ct);

                        dfa_Edges.insert(DFA_Edge(i->first, i->second, t, pState));
                    }
                }

                for (typename set<pair<String_Type, bool> >::const_iterator i = strings.begin(), m = strings.end(); i != m; ++i)
                {
                    EpsilonClosureInfo info;
                    epsilonClosure(move(*t, i->first, i->second), info);

                    DFA_State* p = getDFAState(info.states, c);
                    if (p) // 濡傛灉榪欎釜鐘舵佸凡瀛樺湪
                    {
                        dfa_Edges.insert(DFA_Edge(i->first, i->second, t, p));
                    }
                    else
                    {
                        DFA_State* pState = DFA_State_Alloc::allocate();
                        construct(pState, info.states);
                        context.dfa_States.insert(pState);

                        if (isEndDFAStatus(pState)) pDFAEnds.insert(pState);

                        c_type ct(pState, info);
                        c[info.states.size()].push_back(ct);
                        c2.push(ct);

                        dfa_Edges.insert(DFA_Edge(i->first, i->second, t, pState));
                    }
                }
                c2.pop();
            }
        }

 

 

灝懼0

鍚屾牱鎴戜滑鏉ョ紪鍐欎竴涓嚱鏁版潵鎵撳嵃鍑篋FA銆?/p>

 

        void printDFA()
        {
            printf("---------- DFA Start ----------\n");
            set<DFA_State*> tmp;
            for (typename set<DFA_Edge>::const_iterator i = dfa_Edges.begin(), m = dfa_Edges.end(); i != m; ++i)
            {
                printf("%03d -> %03d", i->pFrom->idx, i->pTo->idx);
                switch (i->edgeType())
                {
                case DFA_Edge::TChar:
                    printf("(%c)", i->data.char_value);
                    break;
                case DFA_Edge::TString:
                    printf("(%s)", i->data.string_value.c_str());
                    break;
                default:
                    break;
                }
                if (i->isNot()) printf("(not)");
                printf("\n");
                tmp.insert(i->pFrom);
                tmp.insert(i->pTo);
            }

            printf("start: %03d -> ends: ", pDFAStart->idx);
            for (typename set<DFA_State*>::const_iterator i = pDFAEnds.begin(), m = pDFAEnds.end(); i != m; ++i)
            {
                printf("%03d ", (*i)->idx);
            }
            printf("\n");
#if DEBUG_LEVEL == 3
            printf("-------------------------------\n");

            for (typename set<DFA_State*>::const_iterator i = tmp.begin(), m = tmp.end(); i != m; ++i)
            {
                printf("State: %03d\n", (*i)->idx);
                for (typename set<EpsilonNFA_State*>::const_iterator j = (*i)->content.begin(), n = (*i)->content.end(); j != n; ++j)
                {
                    printf("%03d ", (*j)->idx);
                }
                printf("\n");
            }
#endif
            printf("----------- DFA End -----------\n");
        }

 

 

鏈鍚庢垜浠姞鍏ユ祴璇曚唬鐮?/p>

 

Rule_Type::Context context;
Rule_Type a('a', context), b('b', context), d('d', context);
Rule_Type result = (a - d).opt() + (+b | !(a + b));
result.buildDFA();

#ifdef _DEBUG
result.printEpsilonNFA();
result.printDFA();
#endif

 

 

鍙墦鍗板嚭濡備笅鍐呭

DFA

鐢繪垚鍥懼涓?/p>

DFA鍥? src=

瀹屾暣鐨勪唬鐮佸彲鍒?a target="_blank">http://code.google.com/p/qlanguage涓嬭澆



lwch 2013-02-23 23:30 鍙戣〃璇勮
]]>
璇嶆硶鍒嗘瀽鍣?(姝e垯琛ㄨ揪寮忓埌&epsilon;-NFA鐨勮漿鎹?http://www.shnenglu.com/lwch/archive/2013/02/15/197848.htmllwchlwchFri, 15 Feb 2013 12:29:00 GMThttp://www.shnenglu.com/lwch/archive/2013/02/15/197848.htmlhttp://www.shnenglu.com/lwch/comments/197848.htmlhttp://www.shnenglu.com/lwch/archive/2013/02/15/197848.html#Feedback3http://www.shnenglu.com/lwch/comments/commentRss/197848.htmlhttp://www.shnenglu.com/lwch/services/trackbacks/197848.html鑷姩鏈?/h1>

鍏充簬鑷姩鏈虹殑璇存槑錛岃繖閲屼笉涓嶅啀澶嶈堪錛岃鍒?a href="http://zh.wikipedia.org/wiki/鑷姩鏈? target="_blank">http://zh.wikipedia.org/wiki/鑷姩鏈?/a>鏌ョ湅銆?/p>

琛ㄨ揪寮?/h1>

棣栧厛錛屾垜浠瀹氳〃杈懼紡涓彧鍏佽杈撳叆Char_Type鍜孲tring_Type綾誨瀷鐨勫瓧絎︺?/p>

template <typename Char_Type, typename String_Type>
class Rule
{
};

 

ε-NFA鐨勭姸鎬?/h1>

瀵逛簬涓涓姸鎬佹潵璇達紝鎴戜滑騫朵笉闇瑕佺煡閬撲粬鐨勪換浣曚俊鎭?/p>

鍦ㄤ笂闈㈢殑浠g爜涓紝涓轟簡璋冭瘯鏂逛究錛屾垜涓哄叾鍔犲叆浜唅dx鍩燂紝騫朵負姣忎釜鐘舵佸垎閰嶄簡涓涓敮涓鐨処D銆?/p>

 struct EpsilonNFA_State
{
#ifdef _DEBUG
uint idx;
EpsilonNFA_State()
{
idx = inc();
}
static uint inc()
{
static uint i = 0;
return i++;
}
#else
EpsilonNFA_State() {}
#endif
};

ε-NFA鐨勮竟

ε-NFA涓殑杈歸兘鏄湁鍚戠殑銆傚浜庝換鎰忎竴鏉¤竟鏉ヨ錛屾渶閲嶈鐨勬槸浠栫殑涓や釜绔偣鏄皝浠ュ強榪欐潯杈規墍瀵瑰簲鐨勫瓧絎﹂泦錛堣嫢榪欐潯杈逛笉鏄?#949;杈癸級銆?/p>

 struct EpsilonNFA_Edge
{
struct
{
Char_Type char_value;
String_Type string_value;
}data;
enum Edge_Type
{
TUnknown = 0,
TNot = 1,
TChar = 2,
TString = 4,
TEpsilon = 8
};
uchar edge_type;
EpsilonNFA_State* pFrom;
EpsilonNFA_State* pTo;
EpsilonNFA_Edge(EpsilonNFA_State* pFrom, EpsilonNFA_State* pTo) : edge_type(TEpsilon), pFrom(pFrom), pTo(pTo) {}
EpsilonNFA_Edge(const Char_Type& x, EpsilonNFA_State* pFrom, EpsilonNFA_State* pTo) : edge_type(TChar), pFrom(pFrom), pTo(pTo)
{
data.char_value = x;
}
EpsilonNFA_Edge(const String_Type& x, EpsilonNFA_State* pFrom, EpsilonNFA_State* pTo) : edge_type(TString), pFrom(pFrom), pTo(pTo)
{
data.string_value = x;
}
inline void negate()
{
edge_type ^= TNot;
}
inline const bool isNot()const
{
return (edge_type & TNot) == TNot;
}
inline const bool isEpsilon()const
{
return (edge_type & TEpsilon) == TEpsilon;
}
inline const bool isChar()const
{
return (edge_type & TChar) == TChar;
}
inline const bool isString()const
{
return (edge_type & TString) == TString;
}
const Edge_Type edgeType()const
{
if (isEpsilon()) return TEpsilon;
else if (isChar()) return TChar;
else if (isString()) return TString;
else return TUnknown;
}
};

鏈変簡浠ヤ笂涓や釜緇撴瀯涔嬪悗錛屾垜浠負Rule娣誨姞涓変釜鎴愬憳鍙橀噺

EpsilonNFA_State *pEpsilonStart, *pEpsilonEnd;
hashmap<EpsilonNFA_State*, vector<EpsilonNFA_Edge>, _hash> epsilonNFA_Edges;

 

pEpsilonStart鍜宲EpsilonEnd鍒嗗埆琛ㄧず榪欐潯琛ㄨ揪寮忔墍瀵瑰簲鐘舵佹満鐨剆tart鍜宔nd鐘舵侊紝epsilonNFA_Edges鍒欐槸浠ユ煇涓姸鎬佷綔涓簁ey錛屼粠榪欎釜鐘舵佸埌杈懼彟涓涓姸鎬佹墍緇忚繃鐨勮竟浣滀負value鐨刪ash琛ㄣ?/p>

鐢熸垚鐘舵佹満

緇堜簬鍒頒簡姝i錛岄鍏堬紝鎴戜滑鎶婃墍鏈夌殑鍏崇郴鍒嗕負涓茶仈鍏崇郴銆佸茍鑱斿叧緋匯佸彲閫夊叧緋匯?嬈″強浠ヤ笂鐨勯噸澶嶅叧緋匯佽嚦灝?嬈′互涓婄殑閲嶅鍏崇郴鍜屽彇鍙嶅叧緋匯備笅闈㈠垎鍒粙緇嶆瘡縐嶅叧緋葷殑ε-NFA濡備綍鏉ョ敓鎴愩傦紙涓嬫枃涓嫢娌℃湁鎸囧嚭榪炴帴杈圭殑綾誨瀷鍒欐槸ε杈?/strong>錛?/p>

瀛楃闆?/h2>

姝e涓婃枃鎵璇達紝瀛楃闆嗗寘鎷珻har_Type鍜孲tring_Type綾誨瀷鐨勫瓧絎︼紝搴旀鐢熸垚瀛楃闆嗙殑鐘舵佹満灝辨瘮杈冪畝鍗曚簡錛屽彧闇鍒涘緩鍑轟袱涓姸鎬侊紝鐒跺悗閫氳繃涓鏉$粡榪囪繖涓瓧絎﹂泦鐨勮竟灝嗚繖涓や釜鐘舵佹寜鐓ф煇涓柟鍚戣繛鎺ワ紝鏈鍚庡皢涓涓姸鎬佹爣璁頒負start鐘舵侊紝鍙︿竴涓姸鎬佹爣璁頒負end鐘舵佸嵆鍙?/p>

 Rule(const Char_Type& x, Context& context) : pDFAStart(NULL), context(context)
{
pEpsilonStart = EpsilonNFA_State_Alloc::allocate();
construct(pEpsilonStart);
pEpsilonEnd = EpsilonNFA_State_Alloc::allocate();
construct(pEpsilonEnd);
epsilonNFA_Edges[pEpsilonStart].push_back(EpsilonNFA_Edge(x, pEpsilonStart, pEpsilonEnd));
context.epsilonNFA_States.insert(pEpsilonStart);
context.epsilonNFA_States.insert(pEpsilonEnd);
}
Rule(const String_Type& x, Context& context) : pDFAStart(NULL), context(context)
{
pEpsilonStart = EpsilonNFA_State_Alloc::allocate();
construct(pEpsilonStart);
pEpsilonEnd = EpsilonNFA_State_Alloc::allocate();
construct(pEpsilonEnd);
epsilonNFA_Edges[pEpsilonStart].push_back(EpsilonNFA_Edge(x, pEpsilonStart, pEpsilonEnd));
context.epsilonNFA_States.insert(pEpsilonStart);
context.epsilonNFA_States.insert(pEpsilonEnd);
}

涓茶仈鍏崇郴

涓茶仈鍏崇郴涓紝鍙渶瑕佸皢鍓嶄竴涓姸鎬佹満鐨別nd鐘舵侀氳繃ε杈硅繛鎺ュ埌鍙︿竴涓姸鎬佹満鐨剆tart鐘舵侊紝鏈鍚庡皢鍓嶄竴涓姸鎬佺殑start鐘舵佹爣璁頒負鏂扮姸鎬佹満鐨剆tart鐘舵侊紝鍚庝竴涓姸鎬佹満鐨別nd鐘舵佹爣璁頒負鏂扮姸鎬佹満鐨別nd鐘舵佸嵆鍙?/p>

 self operator+(const self& x)
{
self a = cloneEpsilonNFA(*this), b = cloneEpsilonNFA(x);
copyEpsilonNFA_Edges(b, a);
a.epsilonNFA_Edges[a.pEpsilonEnd].push_back(EpsilonNFA_Edge(a.pEpsilonEnd, b.pEpsilonStart));
a.pEpsilonEnd = b.pEpsilonEnd;
return a;
}

 

騫惰仈鍏崇郴

騫惰仈鍏崇郴涓紝闇瑕佸垎鍒柊寤轟竴涓猻tart鍜宔nd鐘舵佸仛涓烘柊鐘舵佹満鐨剆tart鍜宔nd鐘舵侊紝鐒跺悗灝嗘柊鐢熸垚鐨剆tart鐘舵佸垎鍒繛鎺ュ埌鍘熺姸鎬佹満鐨剆tart鐘舵侊紝鍘熺姸鎬佹満鐨別nd鐘舵佽繛鎺ュ埌鏂扮敓鎴愮殑end鐘舵佸嵆鍙?/p>

 self operator|(const self& x)
{
self a = cloneEpsilonNFA(*this), b = cloneEpsilonNFA(x);
copyEpsilonNFA_Edges(b, a);
EpsilonNFA_State* _pStart = EpsilonNFA_State_Alloc::allocate();
construct(_pStart);
EpsilonNFA_State* _pEnd = EpsilonNFA_State_Alloc::allocate();
construct(_pEnd);
context.epsilonNFA_States.insert(_pStart);
context.epsilonNFA_States.insert(_pEnd);
a.epsilonNFA_Edges[_pStart].push_back(EpsilonNFA_Edge(_pStart, a.pEpsilonStart));
a.epsilonNFA_Edges[_pStart].push_back(EpsilonNFA_Edge(_pStart, b.pEpsilonStart));
a.epsilonNFA_Edges[a.pEpsilonEnd].push_back(EpsilonNFA_Edge(a.pEpsilonEnd, _pEnd));
a.epsilonNFA_Edges[b.pEpsilonEnd].push_back(EpsilonNFA_Edge(b.pEpsilonEnd, _pEnd));
a.pEpsilonStart = _pStart;
a.pEpsilonEnd = _pEnd;
return a;
}

閲嶅鍏崇郴

鍦ㄦ鍒欒〃杈懼紡涓瓨鍦ㄥ艦濡?a)+鍜?a)*鐨勪袱縐嶉噸澶嶅叧緋伙紝瀵逛簬榪欎袱縐嶉噸澶嶅叧緋伙紝鐢熸垚鐨勭姸鎬佹満鐨勫尯鍒粎鍦ㄤ簬end鐘舵佸浜庝竴嬈′互涓婄殑閲嶅錛屽彧闇瑕佺粰鍘熺姸鎬佹満娣誨姞涓鏉′粠end鐘舵佸埌start鐘舵佺殑ε杈瑰嵆鍙傝屽浜庨浂嬈′互涓婄殑閲嶅錛屼笉鍏夐渶瑕佹坊鍔?#949;杈癸紝鍚屾椂闇瑕佸皢鏂扮姸鎬佹満鐨別nd鐘舵佹爣璁頒負start鐘舵侊紝鍥犱負闆舵閲嶅鏃朵笉闇瑕佺粡榪囦換鎰忚竟鏃㈠彲琚帴鍙椼?/p>

 self operator*()
{
self a = cloneEpsilonNFA(*this);
a.epsilonNFA_Edges.insert(EpsilonNFA_Edge(a.pEpsilonEnd, a.pEpsilonStart));
a.pEpsilonEnd = a.pEpsilonStart;
return a;
}
self operator+()
{
self a = cloneEpsilonNFA(*this);
a.epsilonNFA_Edges[a.pEpsilonEnd].push_back(EpsilonNFA_Edge(a.pEpsilonEnd, a.pEpsilonStart));
return a;
}

涓婇潰榪欎笁縐嶆槸鏈鍩烘湰鐨勭敓鎴愭柟娉曪紝閫氳繃浠ヤ笂榪欎笁縐嶇敓鎴愭柟娉曞凡瓚沖搴斾粯澶氭暟鐨勮〃杈懼紡銆?/p>

涓浜涙嫇灞?/h1>

涓嬮潰鏉ョ湅鐪嬩竴浜涙嫇灞曞艦寮忕殑鐘舵佹満鏄浣曠敓鎴愮殑銆?/p>

鍙夊叧緋?/h2>

鍦ㄥ彲閫夊叧緋諱腑錛屽彧闇瑕佺粰鍘熺姸鎬佹満娣誨姞涓鏉′粠start鐘舵佸埌end鐘舵佺殑ε杈瑰嵆鍙傜敱浜?#949;-NFA鍙厑璁告湁涓涓猻tart鍜宔nd鐘舵佺殑鍏崇郴錛屽簲姝ゅ綋鏉′歡涓嶆垚绔嬫椂浠巗tart鐘舵佸氨鍙洿鎺ラ氳繃ε杈瑰埌杈緀nd鐘舵併?/p>

 inline self opt()
{
self a = cloneEpsilonNFA(*this);
a.epsilonNFA_Edges[a.pEpsilonStart].push_back(EpsilonNFA_Edge(a.pEpsilonStart, a.pEpsilonEnd));
return a;
}

 

鍙栧弽鍏崇郴

鐢變簬鎴戜滑鍙鐞咰har_Type鍜孲tring_Type綾誨瀷鐨勫瓧絎﹂泦錛屽簲姝ゅ浜庡彇鍙嶆垜浠彧闇瑕佸皢褰撳墠鐘舵佹満鍐呮墍鏈夌被鍨嬩負TChar鎴朤String綾誨瀷鐨勮竟鍙栦竴涓嬪弽鍗沖彲錛?strong>闇瑕佹敞鎰忕殑鏄彲鑳藉瓨鍦ㄨ礋璐熷緱姝g殑鎯呭喌錛屾棦鍙栧伓鏁版鍙嶇瓑浜庢病鍙栧弽錛?/p>

 

 self operator!()
{
self a = cloneEpsilonNFA(*this);
for (typename hashmap<EpsilonNFA_State*, vector<EpsilonNFA_Edge>, _hash>::iterator i = a.epsilonNFA_Edges.begin(), m = a.epsilonNFA_Edges.end(); i != m; ++i)
{
for (typename vector<EpsilonNFA_Edge>::iterator j = i->second.begin(), n = i->second.end(); j != n; ++j)
{
if (j->isChar() || j->isString()) j->negate();
}
}
return a;
}

 

 

Char-Char鍏崇郴

鎵璋撶殑char-char鍏崇郴灝辨槸姝e垯琛ㄨ揪寮忎腑鐨刐a-z]琛ㄨ揪寮忋傚叾瀹炶繖鏄竴縐嶅茍鑱斿叧緋葷殑鎷撳睍錛岀敱涓や釜鍘熷鐘舵佹満鎷撳睍鍒頒簡N涓紝鐢熸垚鏂規硶涔熺被浼箋?/p>

 self operator-(const self& x)
{
self a = cloneEpsilonNFA(*this);
if (epsilonNFA_Edges.size() == 1 && x.epsilonNFA_Edges.size() == 1 &&
epsilonNFA_Edges.begin()->second.size() == 1 && x.epsilonNFA_Edges.begin()->second.size() == 1 &&
epsilonNFA_Edges.begin()->second.begin()->edge_type == EpsilonNFA_Edge::TChar && x.epsilonNFA_Edges.begin()->second.begin()->edge_type == EpsilonNFA_Edge::TChar)
{
EpsilonNFA_State* _pStart = EpsilonNFA_State_Alloc::allocate();
construct(_pStart);
EpsilonNFA_State* _pEnd = EpsilonNFA_State_Alloc::allocate();
construct(_pEnd);
context.epsilonNFA_States.insert(_pStart);
context.epsilonNFA_States.insert(_pEnd);
a.epsilonNFA_Edges[_pStart].push_back(EpsilonNFA_Edge(_pStart, a.pEpsilonStart));
a.epsilonNFA_Edges[a.pEpsilonEnd].push_back(EpsilonNFA_Edge(a.pEpsilonEnd, _pEnd));
const Char_Type chStart = epsilonNFA_Edges.begin()->second.begin()->data.char_value;
const Char_Type chEnd = x.epsilonNFA_Edges.begin()->second.begin()->data.char_value;
for (Char_Type ch = chStart + 1; ch < chEnd; ++ch)
{
self y(ch, context);
copyEpsilonNFA_Edges(y, a);
a.epsilonNFA_Edges[_pStart].push_back(EpsilonNFA_Edge(_pStart, y.pEpsilonStart));
a.epsilonNFA_Edges[y.pEpsilonEnd].push_back(EpsilonNFA_Edge(y.pEpsilonEnd, _pEnd));
}
self b = cloneEpsilonNFA(x);
copyEpsilonNFA_Edges(b, a);
a.epsilonNFA_Edges[_pStart].push_back(EpsilonNFA_Edge(_pStart, b.pEpsilonStart));
a.epsilonNFA_Edges[b.pEpsilonEnd].push_back(EpsilonNFA_Edge(b.pEpsilonEnd, _pEnd));
a.pEpsilonStart = _pStart;
a.pEpsilonEnd = _pEnd;
}
else
{
throw error<string>("doesn't support", __FILE__, __LINE__);
}
return a;
}

灝懼0

璁╂垜浠潵緙栧啓涓涓嚱鏁版潵鎵撳嵃鍑烘暣涓敓鎴愬悗鐨勭姸鎬佹満銆?/p>

 void printEpsilonNFA()
{
printf("-------- ε- NFA Start --------\n");
for (typename hashmap<EpsilonNFA_State*, vector<EpsilonNFA_Edge>, _hash>::const_iterator i = epsilonNFA_Edges.begin(), m = epsilonNFA_Edges.end(); i != m; ++i)
{
for (typename vector<EpsilonNFA_Edge>::const_iterator j = i->second.begin(), n = i->second.end(); j != n; ++j)
{
printf("%03d -> %03d", j->pFrom->idx, j->pTo->idx);
switch (j->edgeType())
{
case EpsilonNFA_Edge::TEpsilon:
printf("(ε)");
break;
case EpsilonNFA_Edge::TChar:
printf("(%c)", j->data.char_value);
break;
case EpsilonNFA_Edge::TString:
printf("(%s)", j->data.string_value.c_str());
break;
default:
break;
}
if (j->isNot()) printf("(not)");
printf("\n");
}
}
printf("start: %03d -> end: %03d\n", pEpsilonStart->idx, pEpsilonEnd->idx);
printf("--------- ε- NFA End ---------\n");
}

 

鏈鍚庢垜浠潵緙栧啓涓浜涙祴璇曚唬鐮佹潵璇曡瘯鐢熸垚鏁堟灉濡備綍

Rule_Type::Context context;
Rule_Type a('a', context), b('b', context), d('d', context);
Rule_Type result = (a - d).opt() + (+b | !(a + b));
#ifdef _DEBUG
result.printEpsilonNFA();
#endif

鍙墦鍗板嚭濡備笅鍐呭

鐘舵佹満

鏈鍚庡艦鎴愬艦濡備笅鍥劇殑鐘舵佹満

鐘舵佹満鍥? src=

瀹屾暣鐨勪唬鐮佸彲鍒?a target="_blank">http://code.google.com/p/qlanguage涓嬭澆銆?/p>

lwch 2013-02-15 20:29 鍙戣〃璇勮
]]>
淇浜嗕竴涓叧浜嶤Parser_Input鐨凚ughttp://www.shnenglu.com/lwch/archive/2011/07/10/150615.htmllwchlwchSun, 10 Jul 2011 14:13:00 GMThttp://www.shnenglu.com/lwch/archive/2011/07/10/150615.htmlhttp://www.shnenglu.com/lwch/comments/150615.htmlhttp://www.shnenglu.com/lwch/archive/2011/07/10/150615.html#Feedback0http://www.shnenglu.com/lwch/comments/commentRss/150615.htmlhttp://www.shnenglu.com/lwch/services/trackbacks/150615.html鎴戜滑鍏堜簡鐪嬩笅Alt緇勫悎瀛愮殑鍒嗘瀽浠g爜
 1     virtual O Parser(I& input)
 2     {
 3         I temp = input;
 4         if(O Result = left.Parser(input)) return Result;
 5         input = temp;
 6         if(O Result = right.Parser(input)) return Result;
 7         input = temp;
 8         O Result(GetMM());
 9         return Result;
10     }
褰搇eft鍒嗘瀽澶辮觸鏃朵細灝嗗師鍏堢殑input鍊奸噸鏂拌祴鍊肩粰input,浣嗘鏃跺茍娌℃湁鏀瑰彉SymbolStack鍜孲tringStack,搴旀褰撶涓嬈″垎鏋愬け璐ユ椂SymbolStack鍜孲tringStack涓細鍖呭惈涓浜涢噸澶嶇殑鍊?褰撶劧鍏朵粬緇勫悎瀛愬悓鏍峰瓨鍦ㄨ繖涓棶棰?
搴旀鎴戜負CParser_Input澧炲姞浜嗕袱涓垚鍛樺彉閲忎繚瀛樻鏃剁殑SymbolStack鍜孲tringStack鐨凷ize,褰揝ymbolStack鍜孲tringStack Push鐨勬椂鍊欏悓鏃跺鍔爄nput鐩稿簲鐨勫?
鏈鍚庨噸杞紺Parser_Input鐨刼perator=璧嬪兼搷浣滅,鍦ㄥ叾涓牴鎹師鍏堢殑SymbolStack鍜孲tringStack鐨凷ize鏉ュ脊鍑虹浉搴旀暟閲忕殑閲嶅鍊?br />
 1     CParser_Input& operator=(CParser_Input& _value)
 2     {
 3         LexerTokenList = _value.LexerTokenList;
 4         index = _value.index;
 5 
 6         if(_value.symbolCount < symbolCount && _value.symbolCount)
 7         {
 8             int Count = symbolCount - _value.symbolCount;
 9             for(int i=0;i<Count;i++) SymbolStack.Pop();
10         }
11 
12         if(_value.stringCount < stringCount && _value.stringCount)
13         {
14             int Count = stringCount - _value.stringCount;
15             for(int i=0;i<Count;i++) StringStack.Pop();
16         }
17 
18         symbolCount = SymbolStack.Size();
19         stringCount = StringStack.Size();
20         return *this;
21     }
浠ユ鏉ヨВ鍐砈ymbolStack鍜孲tringStack鐨勫悓姝ラ棶棰?

lwch 2011-07-10 22:13 鍙戣〃璇勮
]]>
QLanguage鐨凙SThttp://www.shnenglu.com/lwch/archive/2011/07/01/149941.htmllwchlwchFri, 01 Jul 2011 13:51:00 GMThttp://www.shnenglu.com/lwch/archive/2011/07/01/149941.htmlhttp://www.shnenglu.com/lwch/comments/149941.htmlhttp://www.shnenglu.com/lwch/archive/2011/07/01/149941.html#Feedback2http://www.shnenglu.com/lwch/comments/commentRss/149941.htmlhttp://www.shnenglu.com/lwch/services/trackbacks/149941.htmlhttp://qlanguage.codeplex.com

1.AST鐨勬瘡涓妭鐐圭敱2涓煙緇勬垚,榪?涓煙鍒嗗埆琛ㄧず褰撳墠鑺傜偣鐨勭被鍨嬪拰闄勫姞淇℃伅銆?br />2.AST鐨勬瘡涓妭鐐瑰寘鍚竴涓寚鍚戝叾瀛愯妭鐐圭殑欏哄簭琛ㄣ?br />3.AST鐨勬瘡涓妭鐐瑰寘鍚寚鍚戜笅涓涓妭鐐圭殑鎸囬拡銆?br />緇間笂鎵榪版垜浠緱鍒癆ST鑺傜偣鐨勪唬鐮侊細
 1     class CSyntaxTreeNode
 2     {
 3     public:
 4         CSyntaxTreeNode(int _type,int _value) : type(_type),value(_value){}
 5 
 6         inline List<NAutoPtr<CSyntaxTreeNode>>& Child()
 7         {
 8             return child;
 9         }
10 
11         inline NAutoPtr<CSyntaxTreeNode> Next()
12         {
13             return next;
14         }
15 
16         inline int& Type()
17         {
18             return type;
19         }
20 
21         inline int& Value()
22         {
23             return value;
24         }
25     protected:
26         int type;
27         int value;
28         List<NAutoPtr<CSyntaxTreeNode>> child;
29         NAutoPtr<CSyntaxTreeNode> next;
30     };
鐒跺悗鎴戜滑緇欏嚭浜嗛儴鍒嗘灇涓炬潵鏍囪瘑鑺傜偣鐨勭被鍨嬶細
 1         // for type
 2         enum TYPE
 3         {
 4             stNull,
 5             stDeclare,
 6             stFunction,
 7             stParamterList,
 8             stIf,
 9             stDo,
10             stExp,
11         };
鏈鍚庢槸涓媯礎ST鐨勬暣浣撶粨鏋勶細
 1 class CParserAnalyze
 2 {
 3 public:
 4     inline void Push(NAutoPtr<CSyntaxTreeNode>& Node)
 5     {
 6         SyntaxTreeStack.Push(Node);
 7     }
 8 
 9     inline NAutoPtr<CSyntaxTreeNode> Pop()
10     {
11         return SyntaxTreeStack.Pop();
12     }
13 
14     inline NAutoPtr<CSyntaxTreeNode> Top()
15     {
16         return SyntaxTreeStack.Top();
17     }
18 
19     inline NAutoPtr<CSyntaxTreeNode> Root()
20     {
21         return SyntaxTreeRoot;
22     }
23 protected:
24     NAutoPtr<CSyntaxTreeNode> SyntaxTreeRoot;            // 璇硶鏍戞牴鑺傜偣
25     Stack<NAutoPtr<CSyntaxTreeNode>> SyntaxTreeStack;    // 璇硶鏍戞爤
26 };

榪欓噷鎴戜滑綆鍗曠殑鍒嗘瀽涓涓嬪垎鏋愯繃紼嬶細
浠f璇彞涓轟緥錛屽叾緇勫悎瀛愪唬鐮佷負錛?br />
1     if_desc = (str_if + exp_desc)[if_desc_first] +
2             (str_then + stmt_list)[if_desc_second] +
3             Parser_Combinator_Node::opt((str_else + stmt_list)[if_desc_third]) +
4             (str_end + str_if)[if_desc_fourth];
鎴戜滑杈撳叆浠g爜錛?br />
1     if a then
2         declare b as integer
3     end if
鍦ㄥ仛璇硶鍒嗘瀽錛?br />1.璇誨叆if a錛宎琚綊綰︿負涓鏉xp鐢熸垚涓涓被鍨嬩負exp鐨勮妭鐐瑰茍鍘嬪叆AST鐨勮娉曟爲鏍堛?br />2.if a琚綊綰︾敓鎴愪竴涓被鍨嬩負stIf鐨勮妭鐐瑰茍寮瑰嚭鏍堥《鐨別xp鑺傜偣濉厖鍒版柊鐢熸垚鐨剆tIf鑺傜偣鐨勭涓涓瓙鑺傜偣銆?br />3.璇誨叆then declare b as integer錛宨nteger琚綊綰︾敓鎴愪竴涓敓綾誨瀷涓簊tDeclare鐨勮妭鐐瑰茍鍘嬪叆璇硶鏍戞爤銆?br />4.declare b as integer琚綊綰︿負鏍堥《鐨剆tDeclare鑺傜偣濉厖涓涓猙鏍囪瘑絎︾殑瀛愯妭鐐廣?br />5.then declare b as integer琚綊綰︼紝棣栧厛寮瑰嚭鏍堥《鐨剆tmt_list鍥犱負榪欓噷鏄痵tDeclare璇存槑stmt_list鏈夊唴瀹瑰簲姝ゅ皢鏍堥《鐨剆tIf鐨勫煎煙鐨勬渶浣庝綅緗負1銆?br />6.else瀛愬彞涓嶅瓨鍦ㄣ?br />7.鏁翠綋琚綊綰︺?br />姝ゆ椂鏍堥《涓簊tIf鑺傜偣錛屽叾涓嶅寘鍚玭ext鑺傜偣錛屾湁涓や釜瀛愯妭鐐瑰垎鍒負stExp鍜宻tDeclare銆?br />
鍒嗘瀽榪囩▼濡備笅鍥撅細
1.
2.
3.
4.
5.
6.
7.

lwch 2011-07-01 21:51 鍙戣〃璇勮
]]>
QLanguage鍩烘湰璇硶http://www.shnenglu.com/lwch/archive/2011/06/27/149572.htmllwchlwchMon, 27 Jun 2011 08:36:00 GMThttp://www.shnenglu.com/lwch/archive/2011/06/27/149572.htmlhttp://www.shnenglu.com/lwch/comments/149572.htmlhttp://www.shnenglu.com/lwch/archive/2011/06/27/149572.html#Feedback0http://www.shnenglu.com/lwch/comments/commentRss/149572.htmlhttp://www.shnenglu.com/lwch/services/trackbacks/149572.html1.綾葷殑瀹氫箟
1 class a [inherit Object]
2 end class

2.綾諱腑鍙互鍖呭惈(澹版槑錛屽嚱鏁幫紝鏂扮被銆傚叾涓櫎浜哻lass閮藉惈鏈塸ublic銆乸rivate銆乸rotected鍜宻tatic灞炴?
1 class a
2     [public] declare a as string // 澹版槑
3 
4     [private] [static] function main() // 鍑芥暟
5     end function
6 
7     class b // 鏂扮被
8     end class
9 end class
3.鍙橀噺澹版槑
1 declare a as integer[,b as integer]
4.鍑芥暟
1 function main([a as integer[,b as integer]])[as integer]
2 end function
5.stmt_list鍖呭惈澹版槑璇彞銆乮f璇彞銆乨o璇彞銆亀hile璇彞銆乫or璇彞銆乻witch璇彞鍜宔xperience琛ㄨ揪寮?br />6.if璇彞
1 if experience then
2 stmt_list
3 [else stmt_list]
4 end if
7.do璇彞
1 do
2 stmt_list
3 while experience end
8.while璇彞
1 while experience do
2 stmt_list
3 end while
9.for璇彞
1 for stmt_list to experience by stmt_list do
2 stmt_list
3 next
10.switch璇彞
1 switch experience do
2 case experience:
3 [stmt_list]
4 [case experience:
5 [stmt_list]]
6 [default:
7 [stmt_list]]
8 end switch
11.experience琛ㄨ揪寮?br />
 1 鍑芥暟璋冪敤璇彞
 2 璧嬪艱鍙?br /> 3 symbol
 4 string
 5 number
 6 true
 7 false
 8 (+|-)experience
 9 not experience
10 experience (&|||^|%) experience
11 experience (>|<|>=|<=|==|!=) experience
12 experience (+|-|*|/) experience
13 ++symbol
14 --symbol
15 symbol++
16 symbol--
12.鍑芥暟璋冪敤璇彞
1 鍑芥暟鍚?鍙傛暟琛?
13.璧嬪艱鍙?br />
1 鍙橀噺=experience

緇勫悎瀛愪唬鐮?br />
 1     program = *item;
 2     item = declare_desc |
 3             class_desc |
 4             function_desc;
 5     property_desc = str_public |
 6                     str_private |
 7                     str_protected;
 8     declare_type = str_integer |
 9                     str_string |
10                     str_bool |
11                     str_real |
12                     type_symbol;
13     paramter_desc_list = (type_symbol + str_as + declare_type) +
14                         *(str_comma + type_symbol + str_as + declare_type);
15     paramter_value_list = exp_desc + *(str_comma + exp_desc);
16     declare_desc = str_declare + type_symbol + str_as + declare_type +
17         *(str_comma + type_symbol + str_as + declare_type);
18     class_desc = str_class + type_symbol +
19                 Parser_Combinator_Node::opt(str_inherit + type_symbol +
20                 *(str_comma + (type_symbol & Parser_Combinator_Node::not(str_class | str_function | property_desc | str_static)))
21                 ) + *class_content_desc + str_end + str_class;
22     class_content_desc = (Parser_Combinator_Node::opt(property_desc) + Parser_Combinator_Node::opt(str_static) +
23                         (declare_desc | function_desc)) |
24                         class_desc;
25     function_desc = (str_function + type_symbol) +
26                     (str_leftbracket + Parser_Combinator_Node::opt(paramter_desc_list) + str_rightbracket) +
27                     Parser_Combinator_Node::opt(str_as + declare_type) +
28                     stmt_list +
29                     (str_end + str_function);
30     stmt_list = *(stmt & Parser_Combinator_Node::not(str_end));
31     stmt = declare_desc |
32             if_desc |
33             do_desc |
34             while_desc |
35             for_desc |
36             switch_desc |
37             exp_desc;
38     if_desc = (str_if + exp_desc) +
39             (str_then + stmt_list) +
40             Parser_Combinator_Node::opt(str_else + stmt_list) +
41             (str_end + str_if);
42     do_desc = (str_do + stmt_list) +
43                 (str_while + exp_desc + str_end);
44     while_desc = str_while + exp_desc + str_do + stmt_list + str_end + str_while;
45     for_desc = str_for + stmt_list + str_to + exp_desc + str_by + stmt_list + str_do + stmt_list + str_next;
46     switch_desc = str_switch + exp_desc + str_do + case_list + str_end + str_switch;
47     case_list = *case_desc;
48     case_desc = (str_case + exp_desc + str_colon + stmt_list) |
49                 (str_default + str_colon + stmt_list);
50     assign_desc = type_symbol + str_equal + exp_desc;
51     call_desc = type_symbol + str_leftbracket + Parser_Combinator_Node::opt(paramter_value_list) + str_rightbracket;
52     logic_desc = (str_not + compare_desc) |
53                 (compare_desc + *((str_operator_and | str_operator_or | str_xor | str_mod) + compare_desc));
54     compare_desc = term_desc + *((str_bigger | str_smaller |
55                                 str_bigger_equal | str_smaller_equal |
56                                 str_equal_equal | str_not_equal) + term_desc);
57     term_desc = factor_desc + *((str_add | str_sub) + factor_desc);
58     factor_desc = self_desc + *((str_mul | str_div) + self_desc);
59     self_desc = (str_add_add + type_symbol) |
60                 (str_sub_sub + type_symbol) |
61                 (type_symbol + str_add_add) |
62                 (type_symbol + str_sub_sub) |
63                 value_desc;
64     value_desc = call_desc |
65                 assign_desc |
66                 type_symbol |
67                 type_string |
68                 type_number |
69                 str_true |
70                 str_false |
71                 ((str_add | str_sub) + logic_desc) |
72                 (str_leftbracket + logic_desc + str_rightbracket);
73     exp_desc = logic_desc;

濡傛湁浠諱綍琛ュ厖灝嗕細鍦ㄦ鏂囨。鏇存柊銆?br />

lwch 2011-06-27 16:36 鍙戣〃璇勮
]]>
ESEngine_Demo5http://www.shnenglu.com/lwch/archive/2011/03/02/140979.htmllwchlwchWed, 02 Mar 2011 05:20:00 GMThttp://www.shnenglu.com/lwch/archive/2011/03/02/140979.htmlhttp://www.shnenglu.com/lwch/comments/140979.htmlhttp://www.shnenglu.com/lwch/archive/2011/03/02/140979.html#Feedback3http://www.shnenglu.com/lwch/comments/commentRss/140979.htmlhttp://www.shnenglu.com/lwch/services/trackbacks/140979.html淇浜嗚瘝娉曞垎鏋愬櫒鐨勪竴浜汢ug.
淇浜嗕竴浜涜繍琛屾椂鐨凚ug.
鏀寔浜嗗崟琛屾敞閲?/鍜屽琛屾敞閲?* */
鏀寔浜嗘墍鏈夌殑鍑芥暟澹版槑褰㈠紡.

ESEngine_Demo5.rar



lwch 2011-03-02 13:20 鍙戣〃璇勮
]]>
ESEngine_Demo4http://www.shnenglu.com/lwch/archive/2011/02/13/139989.htmllwchlwchSun, 13 Feb 2011 11:20:00 GMThttp://www.shnenglu.com/lwch/archive/2011/02/13/139989.htmlhttp://www.shnenglu.com/lwch/comments/139989.htmlhttp://www.shnenglu.com/lwch/archive/2011/02/13/139989.html#Feedback1http://www.shnenglu.com/lwch/comments/commentRss/139989.htmlhttp://www.shnenglu.com/lwch/services/trackbacks/139989.html
ESEngine_Demo4.rar

lwch 2011-02-13 19:20 鍙戣〃璇勮
]]>
QLanguagehttp://www.shnenglu.com/lwch/archive/2011/02/13/139956.htmllwchlwchSat, 12 Feb 2011 16:09:00 GMThttp://www.shnenglu.com/lwch/archive/2011/02/13/139956.htmlhttp://www.shnenglu.com/lwch/comments/139956.htmlhttp://www.shnenglu.com/lwch/archive/2011/02/13/139956.html#Feedback2http://www.shnenglu.com/lwch/comments/commentRss/139956.htmlhttp://www.shnenglu.com/lwch/services/trackbacks/139956.html鍙兘榪樻湁澶ч噺鐨凚ug,璇峰弽棣堢粰QQ:510134884.
QLanguage鐨勫彂灞曢渶瑕佹偍鐨勬敮鎸?img border="0" align="absMiddle" src="http://www.shnenglu.com/CuteSoft_Client/CuteEditor/images/emsmile.gif" alt="" />

寮婧愰」鐩湴鍧:http://qlanguage.codeplex.com/

Demo5:
淇浜嗚瘝娉曞垎鏋愬櫒鐨勪竴浜汢ug.
淇浜嗕竴浜涜繍琛屾椂鐨凚ug.
鏀寔浜嗗崟琛屾敞閲?/鍜屽琛屾敞閲?* */
鏀寔浜嗘墍鏈夌殑鍑芥暟澹版槑褰㈠紡.
http://www.shnenglu.com/lwch/archive/2011/03/02/140979.html

Demo4:
娣誨姞浜咲LL鐨勬敮鎸?瑙丼amples涓嬬殑TestDLL.dll)
http://www.shnenglu.com/lwch/archive/2011/02/13/139989.html

Demo3:
淇浜唕eturn璇彞鐨勪竴浜汢ug
娣誨姞浜咰OM緇勪歡鐨勬敮鎸?瑙丼amples鐩綍涓嬬殑factorial.txt)
http://www.shnenglu.com/lwch/archive/2011/02/07/139787.html

Demo2:
1.淇浜嗗嚱鏁拌皟鐢ㄦ椂鐨勪竴浜汢ug
2.紺轟緥涓鍔犱簡涓涓掑綊姹傞樁涔樼殑渚嬪瓙
http://www.shnenglu.com/lwch/archive/2011/01/30/139624.html

Demo1:
榪愯鏂規硶:
1.鎵撳紑鍛戒護琛屾彁紺虹
2.cd ESEngine.exe鎵鍦ㄨ礬寰?br /> 3.ESEngine xxx.txt 1.Samples鏂囦歡澶逛笅鏈夊嚑涓緥瀛?br /> 2.鍑芥暟鐩墠鍙啓浜?br />   "function" "{Symbol}" "{LQ}" "{RQ}" stmt_list "end" "function"
  "function" "{Symbol}" "{LQ}" "{RQ}" "end" "function"
  "function" "{Symbol}" "{LQ}" paramter_list "{RQ}" "as" var_type stmt_list "end" "function"
  榪欎笁綾?鎵浠ュ浜?br />   function mn(integer s)
 stmts
  end function
  鍦ㄧ敓鎴愯娉曟爲鏃朵細浜х敓閿欒
http://www.shnenglu.com/lwch/archive/2011/01/28/139546.html


lwch 2011-02-13 00:09 鍙戣〃璇勮
]]>
ESEngine_Demo3http://www.shnenglu.com/lwch/archive/2011/02/07/139787.htmllwchlwchMon, 07 Feb 2011 09:27:00 GMThttp://www.shnenglu.com/lwch/archive/2011/02/07/139787.htmlhttp://www.shnenglu.com/lwch/comments/139787.htmlhttp://www.shnenglu.com/lwch/archive/2011/02/07/139787.html#Feedback0http://www.shnenglu.com/lwch/comments/commentRss/139787.htmlhttp://www.shnenglu.com/lwch/services/trackbacks/139787.html娣誨姞浜咰OM緇勪歡鐨勬敮鎸?瑙丼amples鐩綍涓嬬殑factorial.txt)

ESEngine_Demo3.rar

lwch 2011-02-07 17:27 鍙戣〃璇勮
]]>
ESEngine_Demo2http://www.shnenglu.com/lwch/archive/2011/01/30/139624.htmllwchlwchSun, 30 Jan 2011 13:19:00 GMThttp://www.shnenglu.com/lwch/archive/2011/01/30/139624.htmlhttp://www.shnenglu.com/lwch/comments/139624.htmlhttp://www.shnenglu.com/lwch/archive/2011/01/30/139624.html#Feedback0http://www.shnenglu.com/lwch/comments/commentRss/139624.htmlhttp://www.shnenglu.com/lwch/services/trackbacks/139624.html1.淇浜嗗嚱鏁拌皟鐢ㄦ椂鐨勪竴浜汢ug
2.紺轟緥涓鍔犱簡涓涓掑綊姹傞樁涔樼殑渚嬪瓙

ESEngine_Demo2.rar

lwch 2011-01-30 21:19 鍙戣〃璇勮
]]>
ESEngine_Demo1http://www.shnenglu.com/lwch/archive/2011/01/28/139546.htmllwchlwchFri, 28 Jan 2011 13:03:00 GMThttp://www.shnenglu.com/lwch/archive/2011/01/28/139546.htmlhttp://www.shnenglu.com/lwch/comments/139546.htmlhttp://www.shnenglu.com/lwch/archive/2011/01/28/139546.html#Feedback0http://www.shnenglu.com/lwch/comments/commentRss/139546.htmlhttp://www.shnenglu.com/lwch/services/trackbacks/139546.html榪愯鏂規硶:
1.鎵撳紑鍛戒護琛屾彁紺虹
2.cd ESEngine.exe鎵鍦ㄨ礬寰?br>3.ESEngine xxx.txt

1.Samples鏂囦歡澶逛笅鏈夊嚑涓緥瀛?br>2.鍑芥暟鐩墠鍙啓浜?br>  "function" "{Symbol}" "{LQ}" "{RQ}" stmt_list "end" "function"
  "function" "{Symbol}" "{LQ}" "{RQ}" "end" "function"
  "function" "{Symbol}" "{LQ}" paramter_list "{RQ}" "as" var_type stmt_list "end" "function"
  榪欎笁綾?鎵浠ュ浜?br>  function mn(integer s)
 stmts
  end function
  鍦ㄧ敓鎴愯娉曟爲鏃朵細浜х敓閿欒

ESEngine_Demo1_0.rar



lwch 2011-01-28 21:03 鍙戣〃璇勮
]]>
ESLanguage瀵逛簬闈炲父Bug鐨勮〃杈懼紡鐨勭炕璇?/title><link>http://www.shnenglu.com/lwch/archive/2011/01/27/139497.html</link><dc:creator>lwch</dc:creator><author>lwch</author><pubDate>Thu, 27 Jan 2011 13:39:00 GMT</pubDate><guid>http://www.shnenglu.com/lwch/archive/2011/01/27/139497.html</guid><wfw:comment>http://www.shnenglu.com/lwch/comments/139497.html</wfw:comment><comments>http://www.shnenglu.com/lwch/archive/2011/01/27/139497.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.shnenglu.com/lwch/comments/commentRss/139497.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/lwch/services/trackbacks/139497.html</trackback:ping><description><![CDATA[琛ㄨ揪寮?<br> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080">1</span> <span style="COLOR: #000000">function main()<br></span><span style="COLOR: #008080">2</span> <span style="COLOR: #000000">    integer a<br></span><span style="COLOR: #008080">3</span> <span style="COLOR: #000000">    a </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">123</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">5</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a)<br></span><span style="COLOR: #008080">4</span> <span style="COLOR: #000000">end function</span></div> <br>緲昏瘧緇撴灉:<br><img height=431 alt="" src="http://www.shnenglu.com/images/cppblog_com/lwch/ESLanguage006.PNG" width=668 border=0><br><br>琛ㄨ揪寮?<br> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080">1</span> <span style="COLOR: #000000">function main()<br></span><span style="COLOR: #008080">2</span> <span style="COLOR: #000000">    integer a<br></span><span style="COLOR: #008080">3</span> <span style="COLOR: #000000">    a </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">4</span> <span style="COLOR: #000000">end function</span></div> <br>緲昏瘧緇撴灉:<br><img height=431 alt="" src="http://www.shnenglu.com/images/cppblog_com/lwch/ESLanguage007.PNG" width=668 border=0><img src ="http://www.shnenglu.com/lwch/aggbug/139497.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/lwch/" target="_blank">lwch</a> 2011-01-27 21:39 <a href="http://www.shnenglu.com/lwch/archive/2011/01/27/139497.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>ATL璋冪敤COM綾葷殑灝佽http://www.shnenglu.com/lwch/archive/2010/11/20/134179.htmllwchlwchSat, 20 Nov 2010 14:40:00 GMThttp://www.shnenglu.com/lwch/archive/2010/11/20/134179.htmlhttp://www.shnenglu.com/lwch/comments/134179.htmlhttp://www.shnenglu.com/lwch/archive/2010/11/20/134179.html#Feedback0http://www.shnenglu.com/lwch/comments/commentRss/134179.htmlhttp://www.shnenglu.com/lwch/services/trackbacks/134179.html
 1 #pragma once
 2 #include <atlcomcli.h>
 3 
 4 class COMMacro
 5 {
 6 public:
 7     COMMacro(LPTSTR Object);
 8     ~COMMacro();
 9     BOOL Invoke(LPTSTR strFunction,VARIANT* pVarParams,int nParamterCount,VARIANT* pResult);
10     VARIANT ToVARIANT(BSTR str);
11     VARIANT ToVARIANT(int nVal);
12     VARIANT ToVARIANT(bool bVal);
13     VARIANT ToVARIANT(double dVal);
14     VARIANT ToVARIANT_ByRef(BSTR* pStr);
15     VARIANT ToVARIANT_ByRef(int* pnVal);
16     VARIANT ToVARIANT_ByRef(bool* pbVal);
17     VARIANT ToVARIANT_ByRef(double* pdVal);
18     BSTR ToBSTR(VARIANT Val);
19     int ToInt(VARIANT Val);
20     bool ToBool(VARIANT Val);
21     double ToDouble(VARIANT Val);
22 
23     BOOL ToBSTR(LPTSTR src,BSTR& dest);
24 protected:
25     CLSID m_clsID;
26     CComPtr<IUnknown> m_Unknown;
27     CComDispatchDriver* m_pDispatchDriver;
28 };
COM.cpp:
  1 #include "stdafx.h"
  2 #include "COM.h"
  3 #include <comdef.h>
  4 
  5 COMMacro::COMMacro(LPTSTR Object)
  6 {
  7     HRESULT hr = CLSIDFromProgID(Object,&m_clsID);
  8     if(FAILED(hr))
  9     {
 10         throw _com_error(hr);
 11         return;
 12     }
 13     hr = CoCreateInstance(m_clsID,NULL,CLSCTX_ALL,IID_IUnknown,(LPVOID*)&m_Unknown);
 14     if(FAILED(hr))
 15     {
 16         throw _com_error(hr);
 17         return;
 18     }
 19     m_pDispatchDriver = new CComDispatchDriver(m_Unknown);
 20 }
 21 
 22 COMMacro::~COMMacro()
 23 {
 24     delete m_pDispatchDriver;
 25 }
 26 
 27 BOOL COMMacro::Invoke(LPTSTR strFunction,VARIANT* pVarParams,int nParamterCount,VARIANT* pResult)
 28 {
 29     DISPID DispID;
 30     HRESULT hr = m_pDispatchDriver->GetIDOfName(strFunction,&DispID);
 31     if(FAILED(hr))
 32     {
 33         throw _com_error(hr);
 34         return FALSE;
 35     }
 36     hr = m_pDispatchDriver->InvokeN(DispID,pVarParams,nParamterCount,pResult);
 37     if(FAILED(hr))
 38     {
 39         throw _com_error(hr);
 40         return FALSE;
 41     }
 42     return TRUE;
 43 }
 44 
 45 VARIANT COMMacro::ToVARIANT(BSTR str)
 46 {
 47     VARIANT vResult;
 48     vResult.vt = VT_BSTR;
 49     vResult.bstrVal = SysAllocString(str);
 50     return vResult;
 51 }
 52 
 53 VARIANT COMMacro::ToVARIANT(int nVal)
 54 {
 55     VARIANT vResult;
 56     vResult.vt = VT_I4;
 57     vResult.intVal = nVal;
 58     return vResult;
 59 }
 60 
 61 VARIANT COMMacro::ToVARIANT(bool bVal)
 62 {
 63     VARIANT vResult;
 64     vResult.vt = VT_BOOL;
 65     vResult.boolVal = bVal;
 66     return vResult;
 67 }
 68 
 69 VARIANT COMMacro::ToVARIANT(double dVal)
 70 {
 71     VARIANT vResult;
 72     vResult.vt = VT_R8;
 73     vResult.dblVal = dVal;
 74     return vResult;
 75 }
 76 
 77 VARIANT COMMacro::ToVARIANT_ByRef(BSTR* pStr)
 78 {
 79     VARIANT vResult;
 80     vResult.vt = VT_BSTR | VT_BYREF;
 81     vResult.byref = pStr;
 82     return vResult;
 83 }
 84 
 85 VARIANT COMMacro::ToVARIANT_ByRef(int* pnVal)
 86 {
 87     VARIANT vResult;
 88     vResult.vt = VT_I4 | VT_BYREF;
 89     vResult.byref = pnVal;
 90     return vResult;
 91 }
 92 
 93 VARIANT COMMacro::ToVARIANT_ByRef(bool* pbVal)
 94 {
 95     VARIANT vResult;
 96     vResult.vt = VT_BOOL | VT_BYREF;
 97     vResult.byref = pbVal;
 98     return vResult;
 99 }
100 
101 VARIANT COMMacro::ToVARIANT_ByRef(double* pdVal)
102 {
103     VARIANT vResult;
104     vResult.vt = VT_BOOL | VT_BYREF;
105     vResult.byref = pdVal;
106     return vResult;
107 }
108 
109 BSTR COMMacro::ToBSTR(VARIANT Val)
110 {
111     return *(BSTR*)Val.byref;
112 }
113 
114 int COMMacro::ToInt(VARIANT Val)
115 {
116     return *(int*)Val.byref;
117 }
118 
119 bool COMMacro::ToBool(VARIANT Val)
120 {
121     return *(bool*)Val.byref;
122 }
123 
124 double COMMacro::ToDouble(VARIANT Val)
125 {
126     return *(double*)Val.byref;
127 }
128 
129 BOOL COMMacro::ToBSTR(LPTSTR src,BSTR& dest)
130 {
131     dest = SysAllocString(src);
132     return TRUE;
133 }

浣跨敤璇存槑:
1.鏋勯犲嚱鏁?
鍙傛暟(瀛楃涓插父閲?:宸ョ▼鍚?綾誨悕
2.Invoke:
鍙傛暟1(瀛楃涓插父閲?:鍑芥暟鍚?br>鍙傛暟2(VARIANT鏁扮粍):璋冪敤鍙傛暟,浠庡彸鑷沖乏
鍙傛暟3(鏁板煎父閲?:璋冪敤鍙傛暟涓暟
鍙傛暟4(VARIANT鎸囬拡):榪斿洖鍊?br>3.ToVARIANT:灝嗙粰瀹氬弬鏁拌漿鎹負VARIANT綾誨瀷
4.ToVARIANT_ByRef:灝嗙粰瀹氬弬鏁拌漿鎹負ByRef鐨刅ARIANT綾誨瀷
5.ToBSTR:灝嗙粰瀹欱yRef鐨刅ARIANT杞崲涓築STR
6.ToInt:灝嗙粰瀹欱yRef鐨刅ARIANT杞崲涓篿nt
7.ToBool:灝嗙粰瀹欱yRef鐨刅ARIANT杞崲涓篵ool
8.ToDouble:灝嗙粰瀹欱yRef鐨刅ARIANT杞崲涓篸ouble
9.ToBSTR:灝嗙粰瀹氬瓧絎︿覆甯擱噺杞崲涓築STR綾誨瀷

紺轟緥:
 1     CoInitialize(0); // 鍒濆鍖朅TL
 2     try
 3     {
 4         COMMacro m(L"aaa.bbb");
 5         VARIANT vResult,vParams[3];
 6         int i = 100;
 7         BSTR str;
 8         m.ToBSTR(L"abc",str);
 9         vParams[2= m.ToVARIANT(123.456);
10         vParams[1= m.ToVARIANT(i);
11         vParams[0= m.ToVARIANT_ByRef(&str);
12         m.Invoke(L"aaa",vParams,3,&vResult);
13         wprintf(L"%s\n",m.ToBSTR(vParams[0]));
14     }
15     catch(_com_error& e)
16     {
17         wprintf(L"%s\n",e.ErrorMessage());
18     }


lwch 2010-11-20 22:40 鍙戣〃璇勮
]]>
閫掑綊闃朵箻鍑芥暟鐨勮娉曞埗瀵肩炕璇?/title><link>http://www.shnenglu.com/lwch/archive/2010/10/02/128293.html</link><dc:creator>lwch</dc:creator><author>lwch</author><pubDate>Sat, 02 Oct 2010 03:56:00 GMT</pubDate><guid>http://www.shnenglu.com/lwch/archive/2010/10/02/128293.html</guid><wfw:comment>http://www.shnenglu.com/lwch/comments/128293.html</wfw:comment><comments>http://www.shnenglu.com/lwch/archive/2010/10/02/128293.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/lwch/comments/commentRss/128293.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/lwch/services/trackbacks/128293.html</trackback:ping><description><![CDATA[浠g爜: <br> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span> <span style="COLOR: #0000ff">function</span><span style="COLOR: #000000"> fact(</span><span style="COLOR: #0000ff">integer</span><span style="COLOR: #000000"> n) </span><span style="COLOR: #0000ff">as</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">integer</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 2</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> n </span><span style="COLOR: #000000">></span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">then</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 3</span> <span style="COLOR: #000000">        return fact(n </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">) </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> n<br></span><span style="COLOR: #008080"> 4</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 5</span> <span style="COLOR: #000000">        return n<br></span><span style="COLOR: #008080"> 6</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">end</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 7</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">end function</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 8</span> <span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 9</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">function</span><span style="COLOR: #000000"> main()<br></span><span style="COLOR: #008080">10</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">integer</span><span style="COLOR: #000000"> Result<br></span><span style="COLOR: #008080">11</span> <span style="COLOR: #000000">    Result </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> fact(</span><span style="COLOR: #000000">5</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">12</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">end function</span></div> 絎﹀彿琛?<br> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">    n<br> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">    </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000"><br> </span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">    fact<br> </span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">    Result<br> </span><span style="COLOR: #000000">4</span><span style="COLOR: #000000">    </span><span style="COLOR: #000000">5</span><span style="COLOR: #000000"><br> </span><span style="COLOR: #000000">5</span><span style="COLOR: #000000">    main</span></div> 緲昏瘧緇撴灉:<br> <img height=575 alt="" src="http://www.shnenglu.com/images/cppblog_com/lwch/ESLanguage005.PNG" width=668 border=0> <img src ="http://www.shnenglu.com/lwch/aggbug/128293.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/lwch/" target="_blank">lwch</a> 2010-10-02 11:56 <a href="http://www.shnenglu.com/lwch/archive/2010/10/02/128293.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Switch璇彞鐨勮娉曞埗瀵肩炕璇?/title><link>http://www.shnenglu.com/lwch/archive/2010/09/29/128060.html</link><dc:creator>lwch</dc:creator><author>lwch</author><pubDate>Wed, 29 Sep 2010 07:55:00 GMT</pubDate><guid>http://www.shnenglu.com/lwch/archive/2010/09/29/128060.html</guid><wfw:comment>http://www.shnenglu.com/lwch/comments/128060.html</wfw:comment><comments>http://www.shnenglu.com/lwch/archive/2010/09/29/128060.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/lwch/comments/commentRss/128060.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/lwch/services/trackbacks/128060.html</trackback:ping><description><![CDATA[棣栧厛鐢熸垚鎶借薄璇硶鏍?鏂規硶濡備笅:<br>1.鏍硅妭鐐逛負0鏃惰〃紺烘病鏈塪efault鏍囩,涓?鏃惰〃紺烘湁default鏍囩<br>2.絎?涓牴鑺傜偣琛ㄧずswitch閲岀殑鏉′歡<br>3.鑻ユ湁default鏍囩,鍒欐渶鍚庝竴涓牴鑺傜偣涓篸efault瀛愭爲<br>4.姣忎釜鏍硅妭鐐逛負0鏃惰〃紺哄湪姝ゆ爣絳句笅娌℃湁stmt_list璇彞鍧?榪欎釜鑺傜偣鐨勫敮涓瀛╁瓙涓鴻鍖歸厤鐨勮〃杈懼紡;涓?鏃惰〃紺烘湁璇彞鍧?鏍硅妭鐐圭殑宸﹀瀛愯〃紺鴻鍖歸厤鐨勮〃杈懼紡,鍙沖瀛愪負瑕佹墽琛岀殑璇彞鍧?br>娉ㄦ剰:Equal鎸囦護浼氬脊鍑轟袱鎿嶄綔鏁?搴旀鍦‥qual鎸囦護鎵ц涔嬪墠蹇呴』鍏堜繚鐣檚witch閲宔xp鐨勫壇鏈?鍗砅ush涓嬈?,鏈鍚庡脊鍑哄壇鏈?br>嫻嬭瘯浠g爜:<br> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span> <span style="COLOR: #0000ff">integer</span><span style="COLOR: #000000"> aaa,bbb<br></span><span style="COLOR: #008080"> 2</span> <span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 3</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">function</span><span style="COLOR: #000000"> ccc()<br></span><span style="COLOR: #008080"> 4</span> <span style="COLOR: #000000">    switch aaa </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">do</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 5</span> <span style="COLOR: #000000">        default:<br></span><span style="COLOR: #008080"> 6</span> <span style="COLOR: #000000">            aaa </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">123</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 7</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">case</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">123</span><span style="COLOR: #000000">:<br></span><span style="COLOR: #008080"> 8</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">do</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 9</span> <span style="COLOR: #000000">                aaa </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> aaa </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">10</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000"> aaa </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">789</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">end</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">11</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">case</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">456</span><span style="COLOR: #000000">:<br></span><span style="COLOR: #008080">12</span> <span style="COLOR: #000000">            aaa </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">123</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">13</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">end</span><span style="COLOR: #000000"> switch<br></span><span style="COLOR: #008080">14</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">end function</span></div> 鐢熸垚铏氭嫙鏈轟唬鐮?<br><img height=607 alt="" src="http://www.shnenglu.com/images/cppblog_com/lwch/ESLanguage003.PNG" width=668 border=0> <img src ="http://www.shnenglu.com/lwch/aggbug/128060.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/lwch/" target="_blank">lwch</a> 2010-09-29 15:55 <a href="http://www.shnenglu.com/lwch/archive/2010/09/29/128060.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>For璇彞鐨勮娉曞埗瀵肩炕璇?/title><link>http://www.shnenglu.com/lwch/archive/2010/09/22/127329.html</link><dc:creator>lwch</dc:creator><author>lwch</author><pubDate>Wed, 22 Sep 2010 04:20:00 GMT</pubDate><guid>http://www.shnenglu.com/lwch/archive/2010/09/22/127329.html</guid><wfw:comment>http://www.shnenglu.com/lwch/comments/127329.html</wfw:comment><comments>http://www.shnenglu.com/lwch/archive/2010/09/22/127329.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/lwch/comments/commentRss/127329.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/lwch/services/trackbacks/127329.html</trackback:ping><description><![CDATA[For璇彞鐨勭炕璇戞瘮杈冨鏉?鏈?涓墠緗潯浠跺拰榪愯浠g爜,1涓鍙ュ潡,涔熷氨鏈?*3*2*1=24縐嶆儏鍐?搴旀鍦ㄧ敓鎴愭娊璞¤娉曟爲鐨勬椂鍊欐垜閲囩敤鐨勬槸2榪涘埗浣嶆潵琛ㄧず褰撳墠鍧楁槸鍚﹀瓨鍦?鍏朵腑鏈搴曚綅琛ㄧずstmt_list璇彞鍧?鍊掓暟絎?浣嶈〃紺篵y涔嬪悗鐨勮鍙ユ槸鍚﹀瓨鍦?鍊掓暟絎?浣嶈〃紺簍o涔嬪悗鐨勮〃杈懼紡鏄惁瀛樺湪,鍊掓暟絎?浣嶈〃紺篺or涔嬪悗鐨勮鍙ユ槸鍚﹀瓨鍦?<br>浠g爜: <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span> <span style="COLOR: #0000ff">integer</span><span style="COLOR: #000000"> aaa,bbb<br></span><span style="COLOR: #008080"> 2</span> <span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 3</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">function</span><span style="COLOR: #000000"> ccc()<br></span><span style="COLOR: #008080"> 4</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">do</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 5</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> aaa </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">456</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">to</span><span style="COLOR: #000000"> by </span><span style="COLOR: #0000ff">do</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 6</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> aaa </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">456</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">then</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 7</span> <span style="COLOR: #000000">                aaa </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">789</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 8</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">end</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 9</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">next</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">10</span> <span style="COLOR: #000000">        aaa </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">123</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">11</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000"> aaa </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">123</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">end</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">12</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">end function</span></div> 緲昏瘧緇撴灉:<br><img height=431 alt="" src="http://www.shnenglu.com/images/cppblog_com/lwch/ESLanguage002.PNG" width=668 border=0> <img src ="http://www.shnenglu.com/lwch/aggbug/127329.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/lwch/" target="_blank">lwch</a> 2010-09-22 12:20 <a href="http://www.shnenglu.com/lwch/archive/2010/09/22/127329.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>澶嶅悎璇彞鐨勫祵濂楄娉曞埗瀵肩炕璇?/title><link>http://www.shnenglu.com/lwch/archive/2010/09/20/127188.html</link><dc:creator>lwch</dc:creator><author>lwch</author><pubDate>Mon, 20 Sep 2010 14:29:00 GMT</pubDate><guid>http://www.shnenglu.com/lwch/archive/2010/09/20/127188.html</guid><wfw:comment>http://www.shnenglu.com/lwch/comments/127188.html</wfw:comment><comments>http://www.shnenglu.com/lwch/archive/2010/09/20/127188.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.shnenglu.com/lwch/comments/commentRss/127188.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/lwch/services/trackbacks/127188.html</trackback:ping><description><![CDATA[宸插疄鐜癲o,while,if鍜岃祴鍊艱鍙ョ殑璇硶鍒跺緲昏瘧,榪欐灝嗕粬浠愬眰宓屽璧鋒潵鐪嬬湅緲昏瘧緇撴灉鏄惁姝g‘.<br>浠g爜:<br> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span> <span style="COLOR: #0000ff">integer</span><span style="COLOR: #000000"> aaa<br></span><span style="COLOR: #008080"> 2</span> <span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 3</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">function</span><span style="COLOR: #000000"> ccc()<br></span><span style="COLOR: #008080"> 4</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000"> aaa </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">123</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">do</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 5</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">do</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 6</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> aaa </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">123</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">then</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 7</span> <span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> aaa </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">456</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">then</span><span style="COLOR: #000000"> aaa </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">123</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 8</span> <span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"> aaa </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">456</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 9</span> <span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">end</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">10</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">end</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">11</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000"> aaa </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">123</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">end</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">12</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">end</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">13</span> <span style="COLOR: #000000">    aaa </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">456</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">14</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">end function</span></div> 緲昏瘧緇撴灉:<br><img height=687 alt="" src="http://www.shnenglu.com/images/cppblog_com/lwch/ESLanguage_001.PNG" width=668 border=0> <img src ="http://www.shnenglu.com/lwch/aggbug/127188.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/lwch/" target="_blank">lwch</a> 2010-09-20 22:29 <a href="http://www.shnenglu.com/lwch/archive/2010/09/20/127188.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>If璇彞鐨勮娉曞埗瀵肩炕璇?/title><link>http://www.shnenglu.com/lwch/archive/2010/09/19/127034.html</link><dc:creator>lwch</dc:creator><author>lwch</author><pubDate>Sat, 18 Sep 2010 23:27:00 GMT</pubDate><guid>http://www.shnenglu.com/lwch/archive/2010/09/19/127034.html</guid><wfw:comment>http://www.shnenglu.com/lwch/comments/127034.html</wfw:comment><comments>http://www.shnenglu.com/lwch/archive/2010/09/19/127034.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/lwch/comments/commentRss/127034.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/lwch/services/trackbacks/127034.html</trackback:ping><description><![CDATA[<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><span style="COLOR: #008080">1</span> <span style="COLOR: #0000ff">integer</span><span style="COLOR: #000000"> aaa<br></span><span style="COLOR: #008080">2</span> <span style="COLOR: #000000"><br></span><span style="COLOR: #008080">3</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">function</span><span style="COLOR: #000000"> ccc()<br></span><span style="COLOR: #008080">4</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> aaa </span><span style="COLOR: #0000ff">and</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">then</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">5</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">end</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">6</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">end function</span></div> <br><img border=0 alt="" src="http://www.shnenglu.com/images/cppblog_com/lwch/If_001.png" width=677 height=442><br><br> <div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><span style="COLOR: #008080">1</span> <span style="COLOR: #0000ff">integer</span><span style="COLOR: #000000"> aaa<br></span><span style="COLOR: #008080">2</span> <span style="COLOR: #000000"><br></span><span style="COLOR: #008080">3</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">function</span><span style="COLOR: #000000"> ccc()<br></span><span style="COLOR: #008080">4</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> aaa </span><span style="COLOR: #0000ff">and</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">then</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">5</span> <span style="COLOR: #000000">        aaa </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">123</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">6</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">end</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">7</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">end function</span></div> <br><img border=0 alt="" src="http://www.shnenglu.com/images/cppblog_com/lwch/If_002.png" width=677 height=442><br><br> <div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><span style="COLOR: #008080">1</span> <span style="COLOR: #0000ff">integer</span><span style="COLOR: #000000"> aaa<br></span><span style="COLOR: #008080">2</span> <span style="COLOR: #000000"><br></span><span style="COLOR: #008080">3</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">function</span><span style="COLOR: #000000"> ccc()<br></span><span style="COLOR: #008080">4</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> aaa </span><span style="COLOR: #0000ff">and</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">then</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">5</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">6</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">end</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">7</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">end function</span></div> <br><img border=0 alt="" src="http://www.shnenglu.com/images/cppblog_com/lwch/If_003.png" width=677 height=442><br><br> <div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><span style="COLOR: #008080">1</span> <span style="COLOR: #0000ff">integer</span><span style="COLOR: #000000"> aaa<br></span><span style="COLOR: #008080">2</span> <span style="COLOR: #000000"><br></span><span style="COLOR: #008080">3</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">function</span><span style="COLOR: #000000"> ccc()<br></span><span style="COLOR: #008080">4</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> aaa </span><span style="COLOR: #0000ff">and</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">then</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">5</span> <span style="COLOR: #000000">        aaa </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">123</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">6</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">7</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">end</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">8</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">end function</span></div> <br><img border=0 alt="" src="http://www.shnenglu.com/images/cppblog_com/lwch/If_004.png" width=677 height=442><br><br> <div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><span style="COLOR: #008080">1</span> <span style="COLOR: #0000ff">integer</span><span style="COLOR: #000000"> aaa<br></span><span style="COLOR: #008080">2</span> <span style="COLOR: #000000"><br></span><span style="COLOR: #008080">3</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">function</span><span style="COLOR: #000000"> ccc()<br></span><span style="COLOR: #008080">4</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> aaa </span><span style="COLOR: #0000ff">and</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">then</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">5</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">6</span> <span style="COLOR: #000000">        aaa </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">123</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">7</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">end</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">8</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">end function</span></div> <br><img border=0 alt="" src="http://www.shnenglu.com/images/cppblog_com/lwch/If_005.png" width=677 height=442><br><br> <div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><span style="COLOR: #008080">1</span> <span style="COLOR: #0000ff">integer</span><span style="COLOR: #000000"> aaa<br></span><span style="COLOR: #008080">2</span> <span style="COLOR: #000000"><br></span><span style="COLOR: #008080">3</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">function</span><span style="COLOR: #000000"> ccc()<br></span><span style="COLOR: #008080">4</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> aaa </span><span style="COLOR: #0000ff">and</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">then</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">5</span> <span style="COLOR: #000000">        aaa </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">123</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">6</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">7</span> <span style="COLOR: #000000">        aaa </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">456</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">8</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">end</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">9</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">end function</span></div> <br><img border=0 alt="" src="http://www.shnenglu.com/images/cppblog_com/lwch/If_006.png" width=677 height=442> <img src ="http://www.shnenglu.com/lwch/aggbug/127034.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/lwch/" target="_blank">lwch</a> 2010-09-19 07:27 <a href="http://www.shnenglu.com/lwch/archive/2010/09/19/127034.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>ESLanguage閮ㄥ垎璇硶鍒跺緲昏瘧http://www.shnenglu.com/lwch/archive/2010/09/17/126918.htmllwchlwchFri, 17 Sep 2010 14:21:00 GMThttp://www.shnenglu.com/lwch/archive/2010/09/17/126918.htmlhttp://www.shnenglu.com/lwch/comments/126918.htmlhttp://www.shnenglu.com/lwch/archive/2010/09/17/126918.html#Feedback0http://www.shnenglu.com/lwch/comments/commentRss/126918.htmlhttp://www.shnenglu.com/lwch/services/trackbacks/126918.html鐢熸垚鏂規硶:
1.縐昏繘鏃跺皢Number,String鎴朣ymbol鍒嗗埆鍔犲叆瀵瑰簲闆嗗悎
2.褰掔害鏃朵粠闆嗗悎涓彇鍑哄搴旂殑鎴愬憳,騫跺垹闄よ繖鏉′駭鐢熷紡閲岀殑鎵鏈夌粓緇撶
3.灝嗕駭鐢熺殑璇硶鏍戣妭鐐瑰帇鍏ユ爤涓?br>4.褰撻亣鍒頒駭鐢熷紡item_list->item_list item鎴杝tmt_list->stmt_list stmt鏃朵粠鏍堜腑寮瑰嚭涓ら璇硶鏍戝茍鎸夐『搴忚繛鎺ヨ搗鏉?br>5.褰撻亣鍒伴潪緇堢粨絎︽椂寮瑰嚭鐩稿簲鏁伴噺鐨勮娉曟爲鑺傜偣,鐢熸垚鏂扮殑鏍硅妭鐐瑰茍鎶婂脊鍑虹殑璇硶鏍戣妭鐐歸兘榪炴帴鍒拌繖涓柊鐨勬牴鑺傜偣涓?br>6.褰撳綊綰﹀埌絎?鏉′駭鐢熷紡鏃舵鏌ユ爤鐨勫厓绱犳暟閲?1涓烘甯稿?鐒跺悗瀵規娊璞¤娉曟爲榪涜鍓嶅簭閬嶅巻騫剁敓鎴愯櫄鎷熸満浠g爜



lwch 2010-09-17 22:21 鍙戣〃璇勮
]]>
ESLanguage閮ㄥ垎璇硶http://www.shnenglu.com/lwch/archive/2010/09/17/126912.htmllwchlwchFri, 17 Sep 2010 14:04:00 GMThttp://www.shnenglu.com/lwch/archive/2010/09/17/126912.htmlhttp://www.shnenglu.com/lwch/comments/126912.htmlhttp://www.shnenglu.com/lwch/archive/2010/09/17/126912.html#Feedback0http://www.shnenglu.com/lwch/comments/commentRss/126912.htmlhttp://www.shnenglu.com/lwch/services/trackbacks/126912.html闃呰鍏ㄦ枃

lwch 2010-09-17 22:04 鍙戣〃璇勮
]]>
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
      <noscript id="pjuwb"></noscript>
            <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
              <dd id="pjuwb"></dd>
              <abbr id="pjuwb"></abbr>
              亚洲精品中文字幕在线| 欧美巨乳波霸| 国产日韩欧美在线| 欧美在线1区| 午夜一区在线| 狠狠狠色丁香婷婷综合激情| 久久精品日韩一区二区三区| 午夜天堂精品久久久久| 狠狠88综合久久久久综合网| 欧美成人精精品一区二区频| 久久噜噜亚洲综合| 最近中文字幕日韩精品 | 久久婷婷av| 久久久在线视频| 日韩天堂在线视频| 亚洲网站视频| 激情欧美一区二区| 亚洲国产经典视频| 久久久久久久久久久久久久一区| 狼人社综合社区| 欧美大片免费| 亚洲欧美日韩精品久久久久| 午夜欧美视频| 亚洲日本欧美天堂| 亚洲伊人伊色伊影伊综合网| 黄色精品在线看| 最新日韩欧美| 国产欧美一区二区精品性色| 欧美成人自拍| 国产精品国产成人国产三级| 久久伊人一区二区| 欧美三级网页| 久热精品在线| 国产精品一区二区视频| 欧美国产大片| 国产亚洲午夜| 亚洲精品视频中文字幕| 国内精品免费在线观看| 亚洲精品免费看| 国产综合精品| 正在播放亚洲| 亚洲人成77777在线观看网| 亚洲欧美在线播放| 这里只有精品视频在线| 久久午夜激情| 欧美在线免费视频| 欧美日韩精品二区第二页| 久久综合一区| 国产欧美一区二区精品婷婷| 艳女tv在线观看国产一区| 亚洲激情欧美| 久久久91精品国产| 久久精品动漫| 国产精品日日做人人爱| 日韩天堂av| 亚洲每日更新| 欧美freesex8一10精品| 久久久久久久久久久久久女国产乱| 国产精品黄视频| 99re6这里只有精品| 亚洲欧洲精品一区| 老司机一区二区三区| 久久在线免费| 国产亚洲欧美aaaa| 欧美亚洲综合在线| 久久激情网站| 国产一区二区三区的电影 | 一区二区三区四区五区视频| 日韩视频免费看| 欧美成人免费网站| 亚洲二区在线观看| 亚洲精品一二三区| 欧美精品久久久久久久久久| 亚洲国产激情| 中文国产一区| 国产精品国色综合久久| 亚洲在线观看| 久久久噜久噜久久综合| 国产中文一区二区三区| 久久久xxx| 欧美国产欧美亚洲国产日韩mv天天看完整| 国产精品高潮呻吟视频| 亚洲电影自拍| 亚洲精品久久久蜜桃 | 亚洲国产免费| 欧美激情一区二区三区高清视频| 亚洲成色777777女色窝| 亚洲美女中文字幕| 一区二区欧美日韩| 先锋亚洲精品| 欧美激情在线观看| 国产欧美一区二区在线观看| 欲色影视综合吧| 99精品免费视频| 欧美一区二区三区婷婷月色 | 欧美激情影音先锋| 国产三级精品在线不卡| 国产精品三级视频| 亚洲国产女人aaa毛片在线| av成人老司机| 久久国内精品视频| 99精品热视频只有精品10| 久久精品免费播放| 欧美亚洲不卡| 亚洲激情自拍| 久久精品综合网| 亚洲大片一区二区三区| 欧美激情四色| 欧美www视频| 亚洲国产精品999| 久久色中文字幕| 欧美一区二区三区视频免费| 国产精品家教| 欧美淫片网站| 午夜激情一区| 亚洲国产精品www| 欧美成人精品激情在线观看| 久久精品国产成人| 性欧美1819sex性高清| 欧美大片18| 欧美成人综合一区| 亚洲综合三区| 欧美一区二区三区在线看| 国产在线精品一区二区中文| av成人老司机| 国产精品视频一二三| 性娇小13――14欧美| 亚洲网站在线看| 国产欧美日韩免费看aⅴ视频| 久久精品视频免费| 欧美大片在线看| 亚欧美中日韩视频| 麻豆av一区二区三区久久| 国产视频一区欧美| 亚洲美女在线国产| 国产一区视频网站| 欧美黄色aa电影| 国产精品一区免费在线观看| 欧美 日韩 国产一区二区在线视频 | 欧美乱在线观看| 欧美国产精品专区| 国产精品久久久久久五月尺| 亚洲国产精品第一区二区三区| 国产精品亚洲一区二区三区在线| 亚洲国产精品毛片| 国语自产精品视频在线看抢先版结局| 最近中文字幕mv在线一区二区三区四区 | 亚洲一区二区三区色| 亚洲一级电影| 国产精品家庭影院| 一本久道久久综合婷婷鲸鱼| 亚洲美女视频| 欧美成人蜜桃| 亚洲午夜av电影| 久久国产精品毛片| 国产日韩三区| 久久久福利视频| 亚洲精品免费网站| 欧美成年人视频网站| 欧美成人伊人久久综合网| 一本色道久久88综合日韩精品| 欧美三级视频在线| 亚洲午夜一区二区三区| 久久久久成人精品| 一区二区亚洲精品国产| 久久另类ts人妖一区二区| 亚洲国产欧美一区二区三区同亚洲| 黄色一区二区三区四区| 欧美91大片| 午夜精品免费视频| 亚洲欧洲中文日韩久久av乱码| 午夜在线一区| 亚洲精选久久| 亚洲电影激情视频网站| 国产精品人人做人人爽| 久久综合色婷婷| 欧美中文字幕久久| 亚洲欧美日韩一区二区在线 | 亚洲高清不卡av| 国产精品永久免费| 欧美成人综合网站| 久久九九精品99国产精品| 日韩视频一区二区三区在线播放免费观看 | 亚洲人成免费| 亚洲国产精品久久久久秋霞蜜臀| 国产欧美日韩综合精品二区| 国产精品户外野外| 国产精品免费福利| 国产精品久久久久久久久久久久| 欧美激情精品久久久久| 久久久免费精品| 欧美91福利在线观看| 欧美人成在线视频| 国产精品女主播在线观看| 国产精品视频九色porn| 亚洲国产aⅴ天堂久久| 亚洲美女精品久久| 久久资源av| 欧美人与性动交cc0o| 国产精品每日更新|