Defining Contexts in Context-Free Grammars

  • Mikhail Barash
  • Alexander Okhotin
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7183)


Conjunctive grammars (Okhotin, 2001) are an extension of the standard context-free grammars with a conjunction operation, which maintains most of their practical properties, including many parsing algorithms. This paper introduces a further extension to the model, which is equipped with quantifiers for referring to the left context, in which the substring being defined does occur. For example, a rule \(A \rightarrow a \& \triangleleft{B}\) defines a string a, as long as it is preceded by any string defined by B. The paper gives two equivalent definitions of the model—by logical deduction and by language equations—and establishes its basic properties, including a transformation to a normal form, a cubic-time parsing algorithm, and another recognition algorithm working in linear space.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 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), CrossRefGoogle Scholar
  2. 2.
    Chomsky, N.: On certain formal properties of grammars. Information and Control 2(2), 137–167 (1959), Scholar
  3. 3.
    Čulík II, K., Cohen, R.: LR-regular grammars—an extension of LR(k) grammars. Journal of Computer and System Sciences 7(1), 66–96 (1973), Scholar
  4. 4.
    Ésik, Z., Kuich, W.: Boolean fuzzy sets. International Journal of Foundations of Computer Science 18(6), 1197–1207 (2007), MathSciNetCrossRefzbMATHGoogle Scholar
  5. 5.
    Ford, B.: Parsing expression grammars: a recognition-based syntactic foundation. In: Proceedings of POPL 2004, Venice, Italy, January 14-16, pp. 111–122 (2004),
  6. 6.
    Ginsburg, S., Rice, H.G.: Two families of languages related to ALGOL. Journal of the ACM 9, 350–371 (1962), MathSciNetCrossRefzbMATHGoogle Scholar
  7. 7.
    Jeż, A.: Conjunctive grammars can generate non-regular unary languages. International Journal of Foundations of Computer Science 19(3), 597–615 (2008), MathSciNetCrossRefzbMATHGoogle Scholar
  8. 8.
    Jeż, A., Okhotin, A.: Conjunctive grammars over a unary alphabet: undecidability and unbounded growth. Theory of Computing Systems 46(1), 27–58 (2010), MathSciNetCrossRefzbMATHGoogle Scholar
  9. 9.
    Jarzabek, S., Krawczyk, T.: LL-regular grammars. Information Processing Letters 4, 31–37 (1975), Scholar
  10. 10.
    Kountouriotis, V., Nomikos, C., Rondogiannis, P.: Well-founded semantics for Boolean grammars. Information and Computation 207(9), 945–967 (2009), MathSciNetCrossRefzbMATHGoogle Scholar
  11. 11.
    Okhotin, A.: Conjunctive grammars. Journal of Automata, Languages and Combinatorics 6(4), 519–535 (2001)MathSciNetzbMATHGoogle Scholar
  12. 12.
    Okhotin, A.: Conjunctive grammars and systems of language equations. Programming and Computer Science 28(5), 243–249 (2002), MathSciNetCrossRefzbMATHGoogle Scholar
  13. 13.
    Okhotin, A.: Boolean grammars. Information and Computation 194(1), 19–48 (2004), MathSciNetCrossRefzbMATHGoogle Scholar
  14. 14.
    Okhotin, A.: The dual of concatenation. Theoretical Computer Science 345(2-3), 425–447 (2005), MathSciNetCrossRefzbMATHGoogle Scholar
  15. 15.
    Okhotin, A.: Generalized LR parsing algorithm for Boolean grammars. International Journal of Foundations of Computer Science 17(3), 629–664 (2006), MathSciNetCrossRefzbMATHGoogle Scholar
  16. 16.
    Okhotin, A.: Recursive descent parsing for Boolean grammars. Acta Informatica 44(3-4), 167–189 (2007), MathSciNetCrossRefzbMATHGoogle Scholar
  17. 17.
    Okhotin, A.: Fast Parsing for Boolean Grammars: A Generalization of Valiant’s Algorithm. In: Gao, Y., Lu, H., Seki, S., Yu, S. (eds.) DLT 2010. LNCS, vol. 6224, pp. 340–351. Springer, Heidelberg (2010), CrossRefGoogle Scholar
  18. 18.
    Okhotin, A., Reitwießner, C.: Conjunctive grammars with restricted disjunction. Theoretical Computer Science 411(26-28), 2559–2571 (2010), MathSciNetCrossRefzbMATHGoogle Scholar
  19. 19.
    Parr, T., Fisher, K.: LL(*): the foundation of the ANTLR parser generator. In: Programming Language Design and Implementation, PLDI 2011, San Jose, USA, June 4-8, pp. 425–436 (2011),
  20. 20.
    Sikkel, K.: Parsing Schemata. Springer, Heidelberg (1997)CrossRefzbMATHGoogle Scholar
  21. 21.
    Valiant, L.G.: General context-free recognition in less than cubic time. Journal of Computer and System Sciences 10(2), 308–314 (1975), MathSciNetCrossRefzbMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Mikhail Barash
    • 1
    • 2
  • Alexander Okhotin
    • 1
  1. 1.Department of MathematicsUniversity of TurkuTurkuFinland
  2. 2.Turku Centre for Computer ScienceTurkuFinland

Personalised recommendations