Skip to main content

Context-Free Grammars with Lookahead

  • Conference paper
  • First Online:
Book cover Language and Automata Theory and Applications (LATA 2021)

Abstract

We introduce context-free grammars with lookahead. The grammars are an extension of both context-free grammars and parsing expression grammars, hence we can handle the two grammars in a unified way. To accommodate lookahead, we use a language with lookahead, which is a set of string pairs. We considered the grammar as a system of equations and give the language with lookahead by the limit of iterations from the empty set. The language class is closed under union, intersection, complement, and a weak version of concatenation and Kleene star.

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. Aho, A.V.: Indexed grammars—an extension of context-free grammars. J. ACM 15(4), 647–671 (1968)

    Article  MathSciNet  Google Scholar 

  2. Autebert, J.-M., Berstel, J., Boasson, L.: Context-free languages and pushdown automata. In: Rozenberg, G., Salomaa, A. (eds.) Handbook of Formal Languages, pp. 111–174. Springer, Heidelberg (1997). https://doi.org/10.1007/978-3-642-59136-5_3

    Chapter  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  MathSciNet  Google Scholar 

  4. Barash, M., Okhotin, A.: Linear grammars with one-sided contexts and their automaton representation. RAIRO Theor. Inf. Appl. 49(2), 153–178 (2015)

    Article  MathSciNet  Google Scholar 

  5. Brzozowski, J.A.: Derivatives of regular expressions. J. ACM 11(4), 481–494 (1964)

    Article  MathSciNet  Google Scholar 

  6. Chida, N., Kuramitsu, K.: Parsing expression grammars with unordered choices. J. Inf. Process. 25, 975–982 (2017)

    MATH  Google Scholar 

  7. Chomsky, N., Schützenberger, M.: The algebraic theory of context-free languages. In: Computer Programming and Formal Systems, vol. 35, pp. 118–161. Elsevier (1963)

    Google Scholar 

  8. Engelfriet, J.: Top-down tree transducers with regular look-ahead. Math. Syst. Theory 10(1), 289–303 (1977)

    Article  MathSciNet  Google Scholar 

  9. Ford, B.: Parsing expression grammars: a recognition-based syntactic foundation. In: Proceedings of the 31st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 111–122. ACM (2004)

    Google Scholar 

  10. Joshi, A.K., Levy, L.S., Takahashi, M.: Tree adjunct grammars. J. Comput. Syst. Sci. 10(1), 136–163 (1975)

    Article  MathSciNet  Google Scholar 

  11. Kozen, D.: Kleene algebra with tests. ACM Trans. Program. Lang. Syst. 19(3), 427–443 (1997)

    Article  MathSciNet  Google Scholar 

  12. Mascarenhas, F., Medeiros, S., Ierusalimschy, R.: On the relation between context-free grammars and parsing expression grammars. Sci. Comput. Program. 89, 235–250 (2014)

    Article  Google Scholar 

  13. Might, M., Darais, D., Spiewak, D.: Parsing with derivatives: a functional pearl. In: Proceedings of the 16th ACM SIGPLAN International Conference on Functional Programming, pp. 189–195. ACM (2011)

    Google Scholar 

  14. Miyazaki, T., Minamide, Y.: Derivatives of regular expressions with lookahead. J. Inf. Process. 27, 422–430 (2019)

    Google Scholar 

  15. Morihata, A.: Translation of regular expression with lookahead into finite state automaton. Comput. Softw. 29(1), 147–158 (2012)

    Google Scholar 

  16. Okhotin, A.: Boolean grammars. Inf. Comput. 194(1), 19–48 (2004)

    Article  MathSciNet  Google Scholar 

  17. Parr, T., Fisher, K.: LL(*) the foundation of the ANTLR parser generator. In: Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 425–436 (2011)

    Google Scholar 

  18. Sakuma, Y., Minamide, Y., Voronkov, A.: Translating regular expression matching into transducers. J. Appl. Logic 10(1), 32–51 (2012)

    Article  MathSciNet  Google Scholar 

  19. Stockmeyer, L.J., Meyer, A.R.: Word problems requiring exponential time (preliminary report). In: Proceedings of the 5th Annual ACM Symposium on Theory of Computing, pp. 1–9. ACM (1973)

    Google Scholar 

  20. Vardi, M.Y.: The complexity of relational query languages. In: Proceedings of the 14th Annual ACM Symposium on Theory of Computing, pp. 137–146. ACM (1982)

    Google Scholar 

  21. Wotschke, D.: The Boolean closures of the deterministic and nondeterministic context-free languages. In: Brauer, W. (ed.) GI Gesellschaft für Informatik e. V. LNCS, pp. 113–121. Springer, Heidelberg (1973). https://doi.org/10.1007/978-3-662-41148-3_11

    Chapter  Google Scholar 

Download references

Acknowledgment

We are grateful to anonymous reviewers for introducing us to the important references of the grammars with one-sided contexts. This work was supported by JSPS KAKENHI Grant Number 20J23184 and 19K11899.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Takayuki Miyazaki .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2021 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Miyazaki, T., Minamide, Y. (2021). Context-Free Grammars with Lookahead. In: Leporati, A., Martín-Vide, C., Shapira, D., Zandron, C. (eds) Language and Automata Theory and Applications. LATA 2021. Lecture Notes in Computer Science(), vol 12638. Springer, Cham. https://doi.org/10.1007/978-3-030-68195-1_16

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-68195-1_16

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-68194-4

  • Online ISBN: 978-3-030-68195-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics