Abstract

The idea of an LLLR parsing is presented. An LLLR(k) parser can be constructed for any LR(k) grammar but it produces the left parse of the input string in linear time (in respect to the length of the derivation) without backtracking. If used as a basis for a syntax-directed translation, it triggers semantic actions using the top-down strategy just like the canonical LL(k) parser. Hence, from a compiler writer's point of view, it acts as an LL(k) parser. The backbone of the LLLR(k) parser is the LL(k) parser which triggers the embedded left LR(k) parser whenever an LL(k) conflict appears during parsing. Once the embedded LR(k) parser resolves the conflict, it passes the control back to the backbone LL(k) parser together with the left parse of the part of the input string scanned by the embedded LR parser, and LL parsing continues. Hence, LLLR parsing is similar to LL(*) parsing except (a) it uses LR(k) parsers instead of finite automata to resolve the LL(k) conflicts and (b) that it does not need to use backtracking. An LLLR(k) parser is the most appropriate for grammars where the LL(k) conflicting nonterminals appear relatively close to the leaves of the derivation trees.

Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.