考虑字母 ∑ = {0, 1}、空/空字符串λ 以及由正则文法的相应非终结符生成的字符串集 X 0 、X 1和 X 2 。 X 0 、X 1和X 2的关系如下:
X0 = 1 X1
X1 = 0 X1 + 1 X2
X2 = 0 X1 + {λ}
以下哪个选项准确地表示了 X 0 中的字符串?
(A) 10 (0* + (10)*)1
(B) 10 (0* + (10)*)*1
(C) 1(0* + 10)*1
(D) 10 (0 + 10)*1 + 110 (0 + 10)*1答案: (C)
解释:
The smallest possible string by given grammar is "11".
X0 = 1X1
= 11X2 [Replacing X1 with 1X2]
= 11 [Replacing X2 with λ]
The string "11" is only possible with option (C).
这个问题的测验