5,018 research outputs found
LLLR Parsing: a Combination of LL and LR Parsing
A new parsing method called LLLR parsing is defined and a method for producing LLLR parsers is described. An LLLR parser uses an LL parser as its backbone and parses as much of its input string using LL parsing as possible. To resolve LL conflicts it triggers small embedded LR parsers. An embedded LR parser starts parsing the remaining input and once the LL conflict is resolved, the LR parser produces the left parse of the substring it has just parsed and passes the control back to the backbone LL parser. The LLLR(k) parser can be constructed for any LR(k) grammar. It produces the left parse of the input string without any backtracking and, if used for a syntax-directed translation, it evaluates semantic actions using the top-down strategy just like the canonical LL(k) parser. An LLLR(k) parser is appropriate for grammars where the LL(k) conflicting nonterminals either appear relatively close to the bottom of the derivation trees or produce short substrings. In such cases an LLLR parser can perform a significantly better error recovery than an LR parser since the most part of the input string is parsed with the backbone LL parser. LLLR parsing is similar to LL(^*) parsing except that it (a) uses LR(k) parsers instead of finite automata to resolve the LL(k) conflicts and (b) does not perform any backtracking
A Parser Generator Based on Earley\u27s Algorithm
Most parser generators are programs that take a context-free grammar specification for a language and generate a parser for that language. Usually, the parsers generated by these parser generators are based on some variations of LL(k) or LR(k) parsing algorithms. The parser generators discussed in this paper creates parsers based on Earlcy\u27s Algorithm. This parser generator creates parsers from any arbitrary context-free grammar specifications; even from ambiguous, cyclic, and unbounded look ahead grammar. These parsers are more powerful than LL(k) and LR(k) parsers and enable the user to create many new applications
Syntactic analysis of LR(k) languages
PhD ThesisA method of syntactic analysis, termed LA(m)LR(k), is discussed
theoretically. Knuth's LR(k) algorithm is included as the special
case m = k. A simpler variant, SLA(m)LR(k) is also described, which
in the case SLA(k)LR(O) is equivalent to the SLR(k) algorithm as
defined by DeRemer. Both variants have the LR(k) property of
immediate detection of syntactic errors.
The case m = 1 k = 0 is examined in detail, when the methods
provide a practical parsing technique of greater generality than
precedence methods in current use. A formal comparison is made with
the weak precedence algorithm.
The implementation of an SLA(1)LR(O) parser (SLR) is described,
involving numerous space and time optimisations. Of importance is a
technique for bypassing unnecessary steps in a syntactic derivation.
Direct comparisons are made, primarily with the simple precedence
parser of the highly efficient Stanford AlgolW compiler, and confirm
the practical feasibility of the SLR parser.The Science Research Council
A General LR(k) Parser Building Algorithm
The problem is to find an efficient algorithm that, given the productions of a context-free grammar G, will discover whether G is LR(k) for given k and if it is build an efficient parser for G . The algorithm is given in Section 8. It is essentially a synthesis of the best parts of Knuth\u27s and DeRemer\u27s algorithms. On simple LR(k) grarranars it yields a result equivalent to DeRemer\u27s algorithm, and like Knuth\u27s algorithm it will work on all LR(k) grammars
Simple chain grammars and languages
A subclass of the LR(0)-grammars, the class of simple chain grammars is introduced. Although there exist simple chain grammars which are not LL(k) for any k>0, this new class of grammars is very closely related to the LL(1) and simple LL(1) grammars. In fact it can be shown that every simple chain grammar has an equivalent simple LL(1) grammar. Cover properties for simple chain grammars are investigated and a deterministic pushdown transducer which acts as a right parser for simple chain grammars is presented
A Drop-in Replacement for LR(1) Table-Driven Parsing
This paper presents a construction method for a deterministic one-symbol look-ahead LR parser which allows non-terminals in the parser look-ahead. This effectively relaxes the requirement of parsing the reverse of the right-most derivation of a string/sentence. This is achieved by replacing the deterministic push down automata of LR parsing by a two-stack automata. The class of grammars accepted by the two-stack parser properly contains the LR(k) grammars. Since the modification to the table-driven LR parsing process is relatively minor and mostly impacts the creation of the goto and action tables, a parser modified to adopt the two-stack process should be comparable in size and performance to LR parsers.</p
The Lane Table Method Of Constructing LR(1) Parsers
The first practical application of the LR algorithm was by [1] for the LALR(1) subset of LR(1) grammars. In [2] an efficient method of producing an LR(1) parser for all LR(1) grammars was described which involves resolving conflicts at states of the LR(0) parsing machine, employing two phases. In Phase 1 the contexts of the productions involved in conflicts are evaluated by a process described there called âlane tracingâ. If conflicts cannot be resolved by these means, then in Phase 2 the parts of the machine involved in lane tracing are regenerated, avoiding the combination of states that potentially lead to conflicts. Other works along the same lines include [4, 5]. The criterion employed in [2] for determining whether or not states may be combined was that of weak compatibility, as defined in [3]. In this paper we describe an alternative method for determining whether states can be combined. According to testing by [6] this method requires less computation. It is also more efficient. when extending the method from LR(1) to LR(k) parsing as described in [7] where very large grammars may be used for the purposes of natural language translation. Taken together with Phase 1, this new method of Phase 2 will, as before, produce a conflict-free LR(1) parser for all LR(1) grammars
- âŠ