Efficient LL(k)
In terms of recognition strength,
LLtechniques are widely held to be inferior toLRparsers. The fact that anyLR(k)grammar can be rewritten to beLR(1), whereasLL(k)is stronger thanLL(1), appears to giveLRtechniques the additional benefit of not requiring k-token lookahead and its associated overhead. In this paper, we suggest thatLL(k)is actually superior toLR(1)when translation, rather than acceptance, is the goal. Further, a practical method of generating efficientLL(k)parsers is presented. This practical approach is based on the fact that most parsing decisions in a typicalLL(k)grammar can be made without comparing k-tuples and often do not even require the full k tokens of look ahead. We denote such"optimized" LL(k)parsers
Implementations
- ANTLR v1