Skip to main content

Generalized LR Parsing for Grammars with Contexts

  • Conference paper
  • First Online:
Computer Science -- Theory and Applications (CSR 2015)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 9139))

Included in the following conference series:

  • 460 Accesses

Abstract

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.

Supported by the Academy of Finland under grant 257857.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Aizikowitz, T., Kaminski, M.: LR(0) conjunctive grammars and deterministic synchronized alternating pushdown automata. In: Kulikov, A., Vereshchagin, N. (eds.) CSR 2011. LNCS, vol. 6651, pp. 345–358. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  2. Barash, M.: Programming language specification by a grammar with contexts. In: NCMA 2013, Umeå, Sweden, pp. 51–67, 13–14 August 2013

    Google Scholar 

  3. Barash, M., Okhotin, A.: An extension of context-free grammars with one-sided context specifications. Inf. Comput. 237, 268–293 (2014)

    Article  MATH  MathSciNet  Google Scholar 

  4. Kipps, J.R.: GLR parsing in time \({\cal O}(n^3)\). In: Tomita, M. (ed.) Generalized LR Parsing, pp. 43–59. Kluwer, Boston (1991)

    Chapter  Google Scholar 

  5. Knuth, D.E.: On the translation of languages from left to right. Inf. Control 8, 607–639 (1965)

    Article  MathSciNet  Google Scholar 

  6. Kowalski, R.: Logic for Problem Solving. Elsevier, Amsterdam (1979)

    MATH  Google Scholar 

  7. Lang, B.: Deterministic techniques for efficient non-deterministic parsers. In: Loeckx, J. (ed.) Automata, Languages and Programming. LNCS, vol. 14, pp. 255–269. Springer, Heidelberg (1974)

    Chapter  Google Scholar 

  8. Okhotin, A.: Conjunctive grammars. J. Automata Lang. Comb. 6(4), 519–535 (2001)

    MATH  MathSciNet  Google Scholar 

  9. Okhotin, A.: LR parsing for conjunctive grammars. Grammars 5, 81–124 (2002)

    Article  MATH  MathSciNet  Google Scholar 

  10. Okhotin, A.: Generalized LR parsing algorithm for Boolean grammars. Int. J. Found. Comput. Sci. 17(3), 629–664 (2006)

    Article  MATH  MathSciNet  Google Scholar 

  11. Okhotin, A.: Conjunctive and Boolean grammars: the true general case of the context-free grammars. Comput. Sci. Rev. 9, 27–59 (2013)

    Article  MATH  Google Scholar 

  12. Okhotin, A.: Improved normal form for grammars with one-sided contexts. In: Jurgensen, H., Reis, R. (eds.) DCFS 2013. LNCS, vol. 8031, pp. 205–216. Springer, Heidelberg (2013)

    Chapter  Google Scholar 

  13. Pereira, F.C.N., Warren, D.H.D.: Parsing as deduction. In: 21st Annual Meeting of the Association for Computational Linguistics, Cambridge, USA, pp. 137–144, 15–17 June 1983

    Google Scholar 

  14. Rabkin, M.: Recognizing two-sided contexts in cubic time. In: Hirsch, E.A., Kuznetsov, S.O., Pin, J.É., Vereshchagin, N.K. (eds.) CSR 2014. LNCS, vol. 8476, pp. 314–324. Springer, Heidelberg (2014)

    Google Scholar 

  15. Rounds, W.C.: LFP: a logic for linguistic descriptions and an analysis of its complexity. Comput. Linguist. 14(4), 1–9 (1988)

    Google Scholar 

  16. Tomita, M.: Efficient Parsing for Natural Language. Kluwer, Boston (1986)

    Book  Google Scholar 

  17. Tomita, M.: An efficient augmented context-free parsing algorithm. Comput. Linguist. 13(1), 31–46 (1987)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Alexander Okhotin .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Springer International Publishing Switzerland

About this paper

Cite this paper

Barash, M., Okhotin, A. (2015). Generalized LR Parsing for Grammars with Contexts. In: Beklemishev, L., Musatov, D. (eds) Computer Science -- Theory and Applications. CSR 2015. Lecture Notes in Computer Science(), vol 9139. Springer, Cham. https://doi.org/10.1007/978-3-319-20297-6_5

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-20297-6_5

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-20296-9

  • Online ISBN: 978-3-319-20297-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics