此為編譯原理實驗報告 學習消除文法左遞規算法,了解消除文法左遞規在語法分析中的作用 內含 設計算法 目的 源碼 等等.... 算法:消除左遞歸算法為: (1)把文法G的所有非終結符按任一種順序排列成P1,P2,…Pn 按此順序執行 (2)FOR i:=1 TO n DO BEGIN FOR j:=1 DO 把形如Pi→Pjγ的規則改寫成 Pi→δ1γ δ2γ … δkγ。其中Pj→δ1 δ2 … δk是關于Pj的所有規則; 消除關于Pi規則的直接左遞歸性 END (3)化簡由(2)所得的文法。即去除那些從開始符號出發永遠無法到達的非終結符的 產生規則。
prolog 找路例子程序:
=== === === === === ===
Part 1-Adding connections
Part 2-Simple Path
example
| ?- path1(a,b,P,T).
will produce the response:
T = 15
P = [a,b] ?
Part 3 - Non-repeating path
As an example, the query:
?- path2(a,h,P,T).
will succeed and may produce the bindings:
P = [a,depot,b,d,e,f,h]
T = 155
Part 4 - Generating a path below a cost threshold
As an example, the query:
?- path_below_cost(a,[a,b,c,d,e,f,g,h],RS,300).
returns:
RS = [a,b,depot,c,d,e,g,f,h] ?
RS = [a,c,depot,b,d,e,g,f,h] ?
no
==================================
分而治之方法還可以用于實現另一種完全不同的排序方法,這種排序法稱為快速排序(quick sort)。在這種方法中, n 個元素被分成三段(組):左段l e f t,右段r i g h t和中段m i d d l e。中段僅包含一個元素。左段中各元素都小于等于中段元素,右段中各元素都大于等于中段元素。因此l e f t和r i g h t中的元素可以獨立排序,并且不必對l e f t和r i g h t的排序結果進行合并。m i d d l e中的元素被稱為支點( p i v o t )。圖1 4 - 9中給出了快速排序的偽代碼
This is an example how one could hide a process on Windows based
operation systems from task viewers like ProcDump (G-RoM, Lorian
& Stone) or ProcessExplorer (SysInternals).
It could e.g. be used as some kind of dump protection.
The way to get this done is very different on NT and 9x machines.