Prove a CFG is ambiguous

909 Views Asked by At

I need to prove this context free grammar ambiguous, I know to prove this I need to find 2 different paths of the same string, but this question has 'begin' and 'end' which I don't know what they mean

S -> begin A end

A -> A ; A | a | S

1

There are 1 best solutions below

4
On BEST ANSWER

Hint:

  • Let $B \to B\ \,;\ B \mid \mathtt{b}$.
  • Prove that the above grammar is ambiguous.
  • Prove that any grammar that uses $B$ is ambiguous.
  • If it is not specified, then "begin" and "end" words are just some terminals (those are lower-case after all).

I hope this helps $\ddot\smile$.