Advertisement

Precedences in specifications and implementations of programming languages

  • Annika Aasa
Session: Compiler Construction II
Part of the Lecture Notes in Computer Science book series (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.

Keywords

Precedence Rule Parse Tree Syntax Tree Operator Precedence Root Operator 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [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. [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. [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. [4]
    A. V. Aho, J. D. Ullman, and R. Sethi. Compilers: Principles, Techniques, Tools. Addison-Wesley Publishing Company, Reading, Mass., 1986.Google Scholar
  5. [5]
    Roland Backhouse. Syntax of Programming Languages, Theory and Practice. Prentice Hall, 1979.Google Scholar
  6. [6]
    W. H. Burge. Recursive Programming Techniques. Addison-Wesley Publishing Company, Reading, Mass., 1975.Google Scholar
  7. [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. [8]
    J. C. Cleaveland and R. C. Uzgalis. Grammars for Programming Languages. Elsevier North-Holland, 1977.Google Scholar
  9. [9]
    A. J. T. Davie and R. Morrison. Recursive Descent Compiling. Ellice Horwood Limited, 1981.Google Scholar
  10. [10]
    Jay Earley. An Efficient Context-Free Parsing Algorithm. Communications of the ACM, 13(2):94–102, February 1970.Google Scholar
  11. [11]
    Jay Earley. Ambiguity and Precedence in Syntax Description. Acta Informatica, 4(2):183–192, 1975.Google Scholar
  12. [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. [13]
    R. W. Floyd. Syntactic Analysis and Operator Precedence. Journal of the ACM, 10(3):316–333, 1963.Google Scholar
  14. [14]
    David R. Hanson. Compact Recursive-descent Parsing of Expressions. Software-Practice and Experience, 15(12):1205–1212, 1985.Google Scholar
  15. [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. [16]
    R. Milner. Standard ML Proposal. Polymorphism: The ML/LCF/Hope Newsletter, 1(3), January 1984.Google Scholar
  17. [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. [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. [19]
    Leon Sterling and Ehud Shapiro. The Art of Prolog. The MIT Press, Cambridge, Massachusetts, London, England, 1986.Google Scholar
  20. [20]
    R.M. Wharton. Resolution of Ambiguity in Parsing. Acta Informatica, 6:387–395, 1976.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1991

Authors and Affiliations

  • Annika Aasa
    • 1
  1. 1.Programming Methodology Group, Dept. of Computer SciencesChalmers University of TechnologyGöteborgSweden

Personalised recommendations