Generalized LR Parsing for Grammars with Contexts

The Generalized LR parsing algorithm for context-free grammars is notable for having a decent worst-case running time (cubic in the length of the input string), as well as much better performance on “good” grammars. This paper extends the Generalized LR algorithm to the case of “grammars with left contexts” (M. Barash, A. Okhotin, “An extension of context-free grammars with one-sided context specifications”, Inform. Comput., 2014), which augment the context-free grammars with special operators for referring to the left context of the current substring, as well as with a conjunction operator (as in conjunctive grammars) for combining syntactical conditions. All usual components of the LR algorithm, such as the parsing table, shift and reduce actions, etc., are extended to handle the context operators. The resulting algorithm is applicable to any grammar with left contexts and has the same worst-case cubic-time performance as in the case of context-free grammars.

[1]  James R. Kipps,et al.  GLR Parsing in Time O( n 3 ) , 1991 .

[2]  Max Rabkin,et al.  Recognizing Two-Sided Contexts in Cubic Time , 2014, CSR.

[3]  Alexander Okhotin,et al.  Generalized Lr Parsing Algorithm for Boolean Grammars , 2006, Int. J. Found. Comput. Sci..

[4]  Masaru Tomita,et al.  An Efficient Augmented-Context-Free Parsing Algorithm , 1987, Comput. Linguistics.

[5]  Alexander Okhotin LR Parsing for Conjunctive Grammars , 2002, Grammars.

[6]  Alexander Okhotin,et al.  Conjunctive and Boolean grammars: The true general case of the context-free grammars , 2013, Comput. Sci. Rev..

[7]  William C. Rounds,et al.  LFP A Logic for Linguistic Descriptions and an Analysis of its Complexity , 1988, Comput. Linguistics.

[8]  Mikhail Barash,et al.  Programming language specification by a grammar with contexts , 2013, NCMA.

[9]  David H. D. Warren,et al.  Parsing as Deduction , 1983, ACL.

[10]  Alexander Okhotin,et al.  Conjunctive Grammars , 2001, J. Autom. Lang. Comb..

[11]  Robert A. Kowalski,et al.  Logic for problem solving , 1982, The computer science library : Artificial intelligence series.

[12]  Alexander Okhotin Improved Normal Form for Grammars with One-Sided Contexts , 2013, DCFS.

[13]  Masaru Tomita,et al.  Efficient parsing for natural language , 1985 .

[14]  Robin Milner,et al.  On Observing Nondeterminism and Concurrency , 1980, ICALP.

[15]  Alexander Okhotin,et al.  An extension of context-free grammars with one-sided context specifications , 2014, Inf. Comput..

[16]  Donald E. Knuth,et al.  On the Translation of Languages from Left to Right , 1965, Inf. Control..

[17]  Michael Kaminski,et al.  LR(0) conjunctive grammars and deterministic synchronized alternating pushdown automata , 2011, J. Comput. Syst. Sci..