What is the formal definition of LR grammar and how to prove it is not ambiguous?

55 Views Asked by At

Hi from wiki it said that LR grammar is type of grammar can be evaluated by LR parsing.

On dragon book, it says:

A grammar for which we can construct a parsing table using one of the methods in this section and the next is said to be an LR grammar.

Both of them are not mathematical definition and hard to describe precisely.

Furthermore, if I define:

$$ s\to AB\\ A\to abc|ab\\ B\to cd|d\\ $$

And set handle of $abcd$ as $ab$, it is obvious that the only sentence will be accepted by LR parser and the grammar is ambiguous.

Thus may I ask a formal (more like mathematical) definition of LR grammar, and prove that it is not ambiguous??

Thanks a lot!