Consider the following (Context-Free) Grammars with only one production rule (not including the epsilon production):

- $ S \rightarrow aSb\space|\space\epsilon$
- $ S \rightarrow aSSb\space|\space\epsilon$
- $ S \rightarrow aSbS\space|\space\epsilon$
- $ S \rightarrow aSaSb\space|\space\epsilon$
- $ S \rightarrow aaSaaSbb\space|\space\epsilon$
- $ S \rightarrow aSbScSdSeSf\space|\space\epsilon$
- $ S \rightarrow aSSbcSd\space|\space\epsilon$
- etc…

Are all these Grammars unambiguous? Will every Grammar with only one production rule (not including the epsilon production) *always* be unambiguous? It would seem so, but I’m not totally sure.

Grammars that only contain *one* unique terminal symbol could be ambiguous. (ex. $ S\rightarrow aSaSa\space|\space\epsilon$ ) However, Grammars with at least *two* distinct terminal symbols seem like they should always be unambiguous.

I’ve tried showing that Grammars like these are $ LL(1)$ . However, it seems only Grammars of the form $ S \rightarrow aSb\space|\space\epsilon$ are $ LL(1)$ . Grammars like $ S \rightarrow aSaSb\space|\space\epsilon$ are *not* $ LL(1)$ . (Illustrated in the parse table below.)

Despite the example Grammar above not being $ LL(1)$ , it still seems to be unambiguous. Maybe it’s simply a matter of using a higher $ k$ for $ LL(k)$ ?

In short, are (Context-Free) Grammars with only **one** production rule (not including the epsilon production) and **at least two** unique terminal symbols always unambiguous?

I would really love some help, any at all would be greatly appreciated.