Skip to main content
Log in

Ambiguity and precedence in syntax description

  • Published:
Acta Informatica Aims and scope Submit manuscript

Summary

This paper describes a method of syntax description for programming languages which allows one to factor out that part of the description which deals with the relative precedences of syntactic units. This has been found to produce simpler and more flexible syntax descriptions. It is done by allowing the normal part of the description, which is done in BNF, to be ambiguous; these ambiguities are then resolved by a separate part of the description which gives precedence relations between the conflicting productions from the grammar. The method can be used with any left-to-right parser which is capable of detecting ambiguities and recognizing which productions they come from; We have studied its use with an LR(1) parser, and it requires a small and localized addition to the parser to enable it to deal with the precedence relations.

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

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Similar content being viewed by others

References

  1. Naur, P., et al.: Revised report on the algorithmic language ALGOL 60. Comm. ACM 6, 1–17 (1963)

    Google Scholar 

  2. Korenjak, A. J.: A practical method for constructing LR(k) processors. Comm. ACM 12, 613–623 (1969)

    Google Scholar 

  3. Earley, J.: An efficient context-free parsing algorithm. Comm. ACM 13, 94–102 (1970)

    Google Scholar 

  4. Reynolds, J. C.: A set-theoretic approach to the concept of type. Argonne National Laboratory, 1969

  5. Knuth, D. E.: On the translation of languages from left to right. Information and Control 8, 607–639 (1965)

    Google Scholar 

  6. De Remer, F. L.: Simple LR(k) grammars. Comm. ACM 14, 453–460 (1971)

    Google Scholar 

  7. Floyd, R. W.: The syntax of programming languages—a survey. IEEE Transactions EC-13, 4 (1964)

    Google Scholar 

  8. Floyd, R. W.: Syntactic analysis and operator precedence. J. ACM 10, 316–333 (1963)

    Google Scholar 

  9. Wirth, N., Weber, H.: Euler—a generalization of ALGOL and its definition. Comm. ACM 9, 13–25 (1966)

    Google Scholar 

  10. Aho, A. V., Johnson, S. C.: LR Parsing. Bell Laboratories, Murray Hill (N.J.)

Download references

Author information

Authors and Affiliations

Authors

Additional information

This work was supported by the National Science Foundation under contract GJ 34342X.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Earley, J. Ambiguity and precedence in syntax description. Acta Informatica 4, 183–192 (1975). https://doi.org/10.1007/BF00288747

Download citation

  • Received:

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF00288747

Keywords

Navigation