Sea G = ({S}, {a, b} R, S) una gramática libre de contexto donde el conjunto de reglas R es
S → a S b | SS | ε
¿Cuál de las siguientes afirmaciones es verdadera?
(A) G no es ambiguo
(B) Existen x, y, ∈ L (G) tales que xy ∉ L(G)
(C) Existe un autómata pushdown determinista que acepta L(G)
(D) Podemos encontrar un autómata determinista de estado finito que acepta L(G)
Respuesta: (C)
Explicación:
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.
Publicación traducida automáticamente
Artículo escrito por GeeksforGeeks-1 y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA