📜  门| GATE-CS-2003 |第90章

📅  最后修改于: 2021-06-28 21:51:24             🧑  作者: Mango

令G =({S},{a,b} R,S)是上下文无关文法,其中规则集R为
S→a S b | SS | ε
下列哪项为真?
(A) G不是模棱两可的
(B)存在x,y,∈L(G)使得xy∉L(G)
(C)有一个确定性下推自动机可以接受L(G)
(D)我们可以找到接受L(G)的确定性有限状态自动机答案: (C)
解释:

An ambiguous grammar can be converted to unambiguous one.

Here we can get grammar in partial GNF form as
S -> ab | abS | aSb | aSbS

We can convert this into GNF too but no need for PDA reasoning
so, above grammar is not a ambiguous thus a definite PDA possible

Trick for this is but just deriving 3-4 strings from grammar, we 
can easily understand its (anbn)* above 
expression anbn is in CFL thus closure of DCFG is a DCFG
i.e., you can get L = {ε, ab, abab, aabb, aabbab, abaabb, 
ababab,......}
PDA will push "a" until "b" is read, start popping "a" for the "b" read.

If "a" is read again from the tape then push only when stack is empty 
else terminate.

Repeat this until string is read.

Remember fastest way to get answer is by elimination other options.

这个问题的测验