Two level grammars: CF-grammars with equation schemes

  • Piotr Dembiński
  • Jan Małuszyński
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 71)


The paper gives another understanding of the two-level grammar formalism: any two-level grammar can be splitted into two parts — a context-free "syntax" and an equational "semantics". It has been shown that in the case of a repetition-free and regular based two-level grammar one can always solve the equations assigned to each derivation of the resulting CF grammar. This suggests an approach to the parsing problem of two-level grammars based on well known methods for CF grammars and the algorithm presented. The approach may occur efficient however, only if some restrictions are imposed on two-level grammars. One sort of restrictions we have discussed in the paper (repetition-free and regular based grammars). Others should result from the requirements of programming languages. For example, one obvious requirement is that two-level grammars should be (semanticaly) unambiguous, i.e., here — in terms of the corresponding CF grammars and equations — that each set of equations has at most one solution.

It could be promising to experiment with (fragments of) ALGOL 68 in order to better understand the described method, its complexity and feasibility with respect to the two-level programming language definitions.


Common Denominator Regular Language String Equation Regular Domain Attribute Grammar 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    Cleaveland, J.C., Uzgalis, R.C.: Grammars for programming languages, Elsevier, New York 1977Google Scholar
  2. [2]
    Dembiński, P., Małuszyński, J.: Attribute grammars and two-level grammars: a unifying approach, Proc. of the MFCS'78 Symposium, Lecture Notes in Computer Sc., 64 143–154, Springer-Verlag 1978Google Scholar
  3. [3]
    Deussen, P.: A decidability criterion for Van Wijngaarden grammars, Acta Informatica 5(4), 353–375, 1975Google Scholar
  4. [4]
    Hesse, W.: Vollstaendige formale Beschreibung von Programmiersprachen mit zweischichtigen Grammetiken, Bericht 7623 TU MuenchenGoogle Scholar
  5. [5]
    Knuth, D.E.: Semantics of context-free languages, Math. Systems Theory. 2(2), 127–145Google Scholar
  6. [6]
    Koster, C.H.A.: Affix grammars, Proc. of the IFIP Working Conf. on ALGOL 68 Implementation, 95–103, North-Holland 1972Google Scholar
  7. [7]
    Lewis, P.H., Rosenkrantz, D.J., Stearns, R.E.: Attributed translations, JCSS 9, 279–307, 1974Google Scholar
  8. [8]
    Wegner, L.: On parsing two-level grammars, Bericht 7/78, TU Graz Institut fuer InformationsverarbeitungGoogle Scholar
  9. [9]
    Van Wijangaarden, A. et al.: Revised report on the algorithmic language ALGOL 68, Acta Informatica 5(1–3), 1–236, 1975Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1979

Authors and Affiliations

  • Piotr Dembiński
    • 1
  • Jan Małuszyński
    • 1
  1. 1.Institute of Computer SciencePolish Academy of SciencesWarsaw PKiN

Personalised recommendations