[理工] [離散]-文法
中正94數學 離散最後一題
m m+n n
Find a phrase-structure grammar to generate the set {0 1 0 |m,n>=0}
Note that a phrase-structure grammar G={V,T,S,P} consists of a vocabulary
V , a set of T consisting of terminal elements, a start symbols S from V
and a set production P .
解答是這樣 V={S,A,B,0,1}
T={0,1}
P={S-->AB , A-->0A1,A-->λ,B-->0B1,B-->λ}
很納悶,這個產生規則的集合,不是要符合正規文法嗎?
A,B應該是non-Terminal
怎麼可以S--->AB ,正規文法不是都是1個terminal或者1個terminal+non-terminal
例如: S0---->a | aA 嗎?
他怎麼可以兩個都是non-terminal (S-->AB)?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.138.106.129
→
03/24 18:29, , 1F
03/24 18:29, 1F
※ 編輯: gn00618777 來自: 220.138.106.129 (03/24 18:31)
→
03/24 18:32, , 2F
03/24 18:32, 2F
推
03/24 18:33, , 3F
03/24 18:33, 3F
→
03/24 18:34, , 4F
03/24 18:34, 4F
→
03/24 18:37, , 5F
03/24 18:37, 5F
→
03/24 18:37, , 6F
03/24 18:37, 6F
→
03/24 18:38, , 7F
03/24 18:38, 7F
→
03/24 18:51, , 8F
03/24 18:51, 8F
推
03/24 22:14, , 9F
03/24 22:14, 9F