My English skill is poor because I'm not a native English speaker. Please understand.
I write this article because want to discuss about this topic.
I think LR parser has no 'practical' advantages over the LL parser. The fact that many tools uses LR parser is not a effective advantage.
I think the criteria of practical advantage is like below.
- Speed (fast -> practical, slow -> impractical)
- Error recovery (easy -> practical, difficult -> impractical)
- Convenience of compiler error display (easy -> practical, difficult -> impractical)
- The cost for parser develop (easy -> practical, difficult -> impractical)
I think that the speed of LL parser and LR parser is not much different. LR parser was fast enough to feel than LL parser because the performance of hardware was low in past. But in today, anymore LR parser is not fast enough to feel than LL parser. addition in today, other factors affect speed are greater. I am emphasizing 'in Today', yes I think the advantage in past is meanless.
So I think there is no significant difference on speed.
And on 2,3,4 feature, LL parser is good than LR parser overwhelmingly. The typical disadvantage of LR parser is difficult error handling. And this cause the external program (ex : IDE) difficult to display useful error. Addition the writing LL parser is easy than LR parser. this means the develop cost is low than LR parser.
'I guess' that clang compiler was consider this (error handling convenience, the development cost) and used LL(k) algorithm. Many modern parser generator, including the clang compiler, use LL(k) on the other hand LR-based compilers and parser generators were created a long time ago and are often updated until now.
I think this phenomenon inform the trend has started to change from LR to LL.
AI algorithm was useless in past because the performance of hardware was low but with improvement of performance of hardware AI algorithm show true worth.
Likewise that in past the performance of hardware was low so the speed of algorithm was top important so has to fast. In the result LR parser was useful greatly. but 'in today' I think the speed is not the only thing that matters because the performance of hardware is so high.
I think the advantage LR parser compare to LL parser is only speed and the speed advantage also is not big. I think this only merit of LR parser gets lower with time because the performance of hardware increase.
I wonder what are the 'practical' advantages of LR parser over LL parser 'in today'?
Thank you for reading.