Skip to main content

Precedences in specifications and implementations of programming languages

  • Session: Compiler Construction II
  • Conference paper
  • First Online:
Programming Language Implementation and Logic Programming (PLILP 1991)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 528))

Abstract

Although precedences are often used to resolve ambiguities in programming language descriptions, there has been no parser-independent definition of languages which are generated by grammars with precedence rules. This paper gives such a definition for a subclass of context-free grammars.

A problem with a language containing infix, prefix and postfix operators of different precedences is that the well-known algorithm, which transforms a grammar with infix operator precedences to an ordinary unambiguous context-free grammar, does not work. This paper gives an algorithm that works also for prefix and postfix operators. An application of the algorithm is also presented.

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

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Annika Aasa. Recursive Descent Parsing of User Defined Distfix Operators. Licentiate Thesis, Dept. of Computer Sciences, Chalmers University of Technology, S-412 96 Göteborg, Sweden, May 1989.

    Google Scholar 

  2. Annika Aasa. Conctypes with precedences. In preparation, Dept. of Computer Sciences, Chalmers University of Technology, S-412 96 Göteborg, Sweden, 1991.

    Google Scholar 

  3. A. V. Aho, S. C. Johnson, and J. D. Ullman. Deterministic Parsing of Ambiguous Grammars. Communications of the ACM, 18(8):441–452, August 1975.

    Google Scholar 

  4. A. V. Aho, J. D. Ullman, and R. Sethi. Compilers: Principles, Techniques, Tools. Addison-Wesley Publishing Company, Reading, Mass., 1986.

    Google Scholar 

  5. Roland Backhouse. Syntax of Programming Languages, Theory and Practice. Prentice Hall, 1979.

    Google Scholar 

  6. W. H. Burge. Recursive Programming Techniques. Addison-Wesley Publishing Company, Reading, Mass., 1975.

    Google Scholar 

  7. R. M. Burstall, D. B. McQueen, and D. T. Sannella. Hope: An Experimental Applicative Language. In Proceedings of the 1980 ACM Symposium on Lisp and Functional Programming, pages 136–143, Stanford, CA, August 1980.

    Google Scholar 

  8. J. C. Cleaveland and R. C. Uzgalis. Grammars for Programming Languages. Elsevier North-Holland, 1977.

    Google Scholar 

  9. A. J. T. Davie and R. Morrison. Recursive Descent Compiling. Ellice Horwood Limited, 1981.

    Google Scholar 

  10. Jay Earley. An Efficient Context-Free Parsing Algorithm. Communications of the ACM, 13(2):94–102, February 1970.

    Google Scholar 

  11. Jay Earley. Ambiguity and Precedence in Syntax Description. Acta Informatica, 4(2):183–192, 1975.

    Google Scholar 

  12. Jon Fairbairn. Making Form Follow Function: An Exercise in Functional Programming Style. Software-Practice and Experience, 17(6):379–386, 1987.

    Google Scholar 

  13. R. W. Floyd. Syntactic Analysis and Operator Precedence. Journal of the ACM, 10(3):316–333, 1963.

    Google Scholar 

  14. David R. Hanson. Compact Recursive-descent Parsing of Expressions. Software-Practice and Experience, 15(12):1205–1212, 1985.

    Google Scholar 

  15. J-P. Jouannaud K. Futatsugi, J. A. Goguen and J. Meseguer. Principles of OBJ2. In Proceedings of the 12:th ACM Symposium on Principles of Programming Languages, pages 52–66, 1985.

    Google Scholar 

  16. R. Milner. Standard ML Proposal. Polymorphism: The ML/LCF/Hope Newsletter, 1(3), January 1984.

    Google Scholar 

  17. Fernando C. N. Pereira and David H. D. Warren. Parsing as deduction. In Proceedings of the 21'st Annual Meeting of the Association for Computational Linguistics, pages 137–144, 1983.

    Google Scholar 

  18. Kent Petersson. LABORATION: Denotationsemantik i ML, 1985. Dept. of Computer Sciences, Univ. of Göteborg and Chalmers Univ. of Tech, S-412 96 Göteborg, Sweden.

    Google Scholar 

  19. Leon Sterling and Ehud Shapiro. The Art of Prolog. The MIT Press, Cambridge, Massachusetts, London, England, 1986.

    Google Scholar 

  20. R.M. Wharton. Resolution of Ambiguity in Parsing. Acta Informatica, 6:387–395, 1976.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Jan Maluszyński Martin Wirsing

Rights and permissions

Reprints and permissions

Copyright information

© 1991 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Aasa, A. (1991). Precedences in specifications and implementations of programming languages. In: Maluszyński, J., Wirsing, M. (eds) Programming Language Implementation and Logic Programming. PLILP 1991. Lecture Notes in Computer Science, vol 528. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-54444-5_98

Download citation

  • DOI: https://doi.org/10.1007/3-540-54444-5_98

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-54444-9

  • Online ISBN: 978-3-540-38362-8

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics