The previous section is finished. ll (1) The main framework of the analysis algorithm, now let's look at the conflict processing ... There are many ways of dealing with conflicts, and this is called eliminating left recursion ...
The upper right grammar is left recursive grammar, you will find that any left recursive grammar is not ll (1), why? For example, if you look at the No. 0 and 1th of the grammar, they can be written in the following way:
E = t + t + t + ...
E = T
It is not difficult to find that their first collection must be coincident, so the left recursive grammar is obviously not ll (1) ... The way to eliminate left recursion is right recursion, as shown in the lower right:
Another commonly used technique called extracting the left male factor ... This is also very simple ...
So wrap it up. LL (1) The analysis algorithm is this:
In other words, some of the grammar is beyond the LL (1) Analysis algorithm analysis, and secondly, even the grammar can be analyzed, may also need to rewrite to resolve the conflict, but often resolved after the grammar will become difficult to understand.
Like this one.
E-E + T
| T
T-.....
After rewriting:
E-T + E '
E-> E ' ....
Obviously it is easy to understand before rewriting ...
The summary is pretty much the case.
Reading dragon Book compiling Principles of Grammar Analysis (9) ...