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.
Preview
Unable to display preview. Download preview PDF.
References
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.
Annika Aasa. Conctypes with precedences. In preparation, Dept. of Computer Sciences, Chalmers University of Technology, S-412 96 Göteborg, Sweden, 1991.
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.
A. V. Aho, J. D. Ullman, and R. Sethi. Compilers: Principles, Techniques, Tools. Addison-Wesley Publishing Company, Reading, Mass., 1986.
Roland Backhouse. Syntax of Programming Languages, Theory and Practice. Prentice Hall, 1979.
W. H. Burge. Recursive Programming Techniques. Addison-Wesley Publishing Company, Reading, Mass., 1975.
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.
J. C. Cleaveland and R. C. Uzgalis. Grammars for Programming Languages. Elsevier North-Holland, 1977.
A. J. T. Davie and R. Morrison. Recursive Descent Compiling. Ellice Horwood Limited, 1981.
Jay Earley. An Efficient Context-Free Parsing Algorithm. Communications of the ACM, 13(2):94–102, February 1970.
Jay Earley. Ambiguity and Precedence in Syntax Description. Acta Informatica, 4(2):183–192, 1975.
Jon Fairbairn. Making Form Follow Function: An Exercise in Functional Programming Style. Software-Practice and Experience, 17(6):379–386, 1987.
R. W. Floyd. Syntactic Analysis and Operator Precedence. Journal of the ACM, 10(3):316–333, 1963.
David R. Hanson. Compact Recursive-descent Parsing of Expressions. Software-Practice and Experience, 15(12):1205–1212, 1985.
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.
R. Milner. Standard ML Proposal. Polymorphism: The ML/LCF/Hope Newsletter, 1(3), January 1984.
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.
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.
Leon Sterling and Ehud Shapiro. The Art of Prolog. The MIT Press, Cambridge, Massachusetts, London, England, 1986.
R.M. Wharton. Resolution of Ambiguity in Parsing. Acta Informatica, 6:387–395, 1976.
Author information
Authors and Affiliations
Editor information
Rights 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