fool2fish / dragon-book-exercise-answers

Compilers Principles, Techniques, & Tools (purple dragon book) second edition exercise answers. 编译原理(紫龙书)第2版习题答案。

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Help!! A question to answer 2.2

ItsBean opened this issue · comments

commented

image
The answer tells me that the grammer is ambiguous by giving the example below, but the example confused me.I don't know why both trees represent the same string .
image

Look at the leaves, the upper one has abεaεbε = abab, the lower one has aεbaεbε = abab, so they are the same strings.

ambiguous parse tree

I'm very much confused with this. The strings are same. But aren't both the trees same?