上下文無關文法(Context-Free Grammar, CFG)是一個4元組G=(V, T, S, P),其中,V和T是不相交的有限集,S∈V,P是一組有限的產生式規則集,形如A→α,其中A∈V,且α∈(V∪T)*。V的元素稱為非終結符,T的元素稱為終結符,S是一個特殊的非終結符,稱為文法開始符。 設G=(V, T, S, P)是一個CFG,則G產生的語言是所有可由G產生的字符串組成的集合,即L(G)={x∈T* | Sx}。一個語言L是上下文無關語言(Context-Free Language, CFL),當且僅當存在一個CFG G,使得L=L(G)。 *⇒ 例如,設文法G:S→AB A→aA|a B→bB|b 則L(G)={a^nb^m | n,m>=1} 其中非終結符都是大寫字母,開始符都是S,終結符都是小寫字母。
標簽: Context-Free Grammar CFG
上傳時間: 2013-12-10
上傳用戶:gaojiao1999
一:需求分析 1. 問題描述 魔王總是使用自己的一種非常精練而抽象的語言講話,沒人能聽懂,但他的語言是可逐步解釋成人能聽懂的語言,因為他的語言是由以下兩種形式的規則由人的語言逐步抽象上去的: ----------------------------------------------------------- (1) a---> (B1)(B2)....(Bm) (2)[(op1)(p2)...(pn)]---->[o(pn)][o(p(n-1))].....[o(p1)o] ----------------------------------------------------------- 在這兩種形式中,從左到右均表示解釋.試寫一個魔王語言的解釋系統,把 他的話解釋成人能聽得懂的話. 2. 基本要求: 用下述兩條具體規則和上述規則形式(2)實現.設大寫字母表示魔王語言的詞匯 小寫字母表示人的語言的詞匯 希臘字母表示可以用大寫字母或小寫字母代換的變量.魔王語言可含人的詞匯. (1) B --> tAdA (2) A --> sae 3. 測試數據: B(ehnxgz)B 解釋成 tsaedsaeezegexenehetsaedsae若將小寫字母與漢字建立下表所示的對應關系,則魔王說的話是:"天上一只鵝地上一只鵝鵝追鵝趕鵝下鵝蛋鵝恨鵝天上一只鵝地上一只鵝". | t | d | s | a | e | z | g | x | n | h | | 天 | 地 | 上 | 一只| 鵝 | 追 | 趕 | 下 | 蛋 | 恨 |
上傳時間: 2014-12-02
上傳用戶:jkhjkh1982
We have a group of N items (represented by integers from 1 to N), and we know that there is some total order defined for these items. You may assume that no two elements will be equal (for all a, b: a<b or b<a). However, it is expensive to compare two items. Your task is to make a number of comparisons, and then output the sorted order. The cost of determining if a < b is given by the bth integer of element a of costs (space delimited), which is the same as the ath integer of element b. Naturally, you will be judged on the total cost of the comparisons you make before outputting the sorted order. If your order is incorrect, you will receive a 0. Otherwise, your score will be opt/cost, where opt is the best cost anyone has achieved and cost is the total cost of the comparisons you make (so your score for a test case will be between 0 and 1). Your score for the problem will simply be the sum of your scores for the individual test cases.
標簽: represented integers group items
上傳時間: 2016-01-17
上傳用戶:jeffery
verilog實現shiftreg,帶測試文件。 文件相當完整,可以下載去測試
上傳時間: 2016-02-06
上傳用戶:zxc23456789
這是一個求數獨遊戲的m-file 在matlab的命令窗口 鍵入>> sudo7 或者run sudo7 的m-file 之後在 9x9 的方格內 填入 數獨的問題 按下 "計算是否有解" 的功能鍵 若不是存在多組的解,則可以 按下 "顯示結果" 的功能鍵, 也可以載入作者測試的"date1"或"date2" 但不可載入及修改"condition"
上傳時間: 2016-11-18
上傳用戶:waizhang
可實現MIMO-OFDM系統的adaptive_blind功能,並進行了詳細的測試
標簽: adaptive_blind MIMO-OFDM 系統
上傳時間: 2013-12-23
上傳用戶:225588
裡面有許多cc2430的範例code,可供使用者測試與更改
上傳時間: 2013-12-11
上傳用戶:chenbhdt
程式描述:使用Cypress的Cy7C68013A晶片進行設計,通過外接EEPROM來進行供電時的重列舉。程式包括USB韌體端的程式以及電腦端的程式。 安裝:把來源程式碼複製到硬碟特定目錄下,使用Keil C編譯器和Visual C++ 6.0運行即可。 注意:可以首先使用Cypress的測試工具進行韌體程式的測試,以確保韌體程式的正確性。
標簽: Cypress 68013A C68013 68013
上傳時間: 2017-02-10
上傳用戶:waitingfy
程式描述:使用Cypress的Cy7C68013A晶片進行設計,實現USB鍵盤輸入的功能。 安裝:把來源程式碼複製到硬碟特定目錄下,使用Keil C編譯器運行即可。 注意:可以首先使用Cypress的測試工具進行韌體程式的測試,以確保韌體程式的正確性。
標簽: Cypress 68013A C68013 68013
上傳時間: 2017-02-10
上傳用戶:ecooo
程式描述:使用Cypress的Cy7C63723晶片進行設計,實現USB介面的HID滑鼠。 安裝:把來源程式碼複製到硬碟特定目錄下,使用Keil C編譯器運行即可。 注意:可以首先使用Cypress的測試工具進行韌體程式的測試,以確保韌體程式的正確性。
上傳時間: 2017-02-10
上傳用戶:6546544