問題:定義爲上下文無關語言 L< {0,1} init (L) = { u | u v ε L for some v in {0, 1}}
If L { w | w is nonempty and has an equal number of 0's and 1's},
then init (L) is set of all binary strings?
答: init (L) is s
設CFG G是: S −→ AB|BA|AC|BD|EE
A −→ a
B −→ b
C −→ EB
D −→ EA
E −→ AB|BA|AC|BD|EE
如何使用CYK算法來確定字串aabbab是語言的一部分? 這是僞代碼,我有我的筆記: for i in 1 .. n
V[i,1] = { A | A -> x[i] }
for j in 2..n
怎樣才能正式上下文無關文法爲以下語言產生: {ai bjck | i != j or j != k} 我有以下生產,但無法理解這一點: S->AX | YC unequal b’s c’s or a’s b’s
A-> aA | e 0 or more A’s
C -> cC |e 0 or more c’s
B -> bB |