Parsing Mixfix Operators

  • Nils Anders Danielsson
  • Ulf Norell
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5836)

Abstract

A simple grammar scheme for expressions containing mixfix operators is presented. The scheme is parameterised by a precedence relation which is only restricted to be a directed acyclic graph; this makes it possible to build up precedence relations in a modular way. Efficient and simple implementations of parsers for languages with user-defined mixfix operators, based on the grammar scheme, are also discussed. In the future we plan to replace the support for mixfix operators in the language Agda with a grammar scheme and an implementation based on this work.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [Aasa(1995)]
    Aasa, A.: Precedences in specifications and implementations of programming languages. Theoretical Computer Science 142(1), 3–26 (1995)MathSciNetCrossRefMATHGoogle Scholar
  2. [Aasa(1992)]
    Aasa, A.: User Defined Syntax. PhD thesis, Chalmers University of Technology (1992)Google Scholar
  3. [Agda Team(2009)]
    The Agda Team. The Agda Wiki (2009), http://wiki.portal.chalmers.se/agda/
  4. [Aho et al.(1986)Aho, Sethi, and Ullman]
    Aho, A.V., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques, and Tools. Addison-Wesley, Reading (1986)MATHGoogle Scholar
  5. [Allen et al.(2008)Allen, Chase, Hallett, Luchangco, Maessen, Ryu, Jr., Tobin-Hochstadt, et al.]
    Allen, E., Chase, D., Hallett, J., Luchangco, V., Maessen, J.-W., Ryu, S., Steele Jr., G.L., Tobin-Hochstadt, S., et al.: The Fortress Language Specification, Version 1.0 (2008)Google Scholar
  6. [Coq Development Team(2009)]
    The Coq Development Team. The Coq Proof Assistant Reference Manual, Version 8.2 (2009)Google Scholar
  7. [Danielsson and Altenkirch(2009)]
    Danielsson, N.A., Altenkirch, T.: Mixing induction and coinduction. Draft (2009)Google Scholar
  8. [Floyd(1963)]
    Floyd, R.W.: Syntactic analysis and operator precedence. Journal of the ACM 10(3), 316–333 (1963)CrossRefMATHGoogle Scholar
  9. [Frost and Szydlowski(1996)]
    Frost, R.A., Szydlowski, B.: Memoizing purely functional top-down backtracking language processors. Science of Computer Programming 27(3), 263–288 (1996)MathSciNetCrossRefMATHGoogle Scholar
  10. [Goguen et al.(1999)Goguen, Winkler, Meseguer, Futatsugi, and Jouannaud]
    Goguen, J.A., Winkler, T., Meseguer, J., Futatsugi, K., Jouannaud, J.-P.: Introducing OBJ (1999)Google Scholar
  11. [Heinlein(2004)]
    Heinlein, C.: C+++: User-defined operator symbols in C++. In: INFORMATIK 2004 – Informatik verbindet, Band 2, Beiträge der 34. Jahrestagung der Gesellschaft für Informatik e.V (GI). Lecture Notes in Informatics, vol. P-51, pp. 459–468 (2004)Google Scholar
  12. [Lotfallah(2009)]
    Lotfallah, W.B.: Characterizing unambiguous precedence systems in expressions without superfluous parentheses. International Journal of Computer Mathematics 86(1), 1–20 (2009)MathSciNetCrossRefMATHGoogle Scholar
  13. [McBride and Paterson(2008)]
    McBride, C., Paterson, R.: Applicative programming with effects. Journal of Functional Programming 18, 1–13 (2008)CrossRefMATHGoogle Scholar
  14. [Missura(1997)]
    Missura, S.A.: Higher-Order Mixfix Syntax for Representing Mathematical Notation and its Parsing. PhD thesis, ETH Zürich (1997)Google Scholar
  15. [Milner et al.(1997)Milner, Tofte, Harper, and MacQueen]
    Milner, R., Tofte, M., Harper, R., MacQueen, D.: The Definition of Standard ML. MIT Press, Cambridge (1997) (revised edition)Google Scholar
  16. [Norell(2007)]
    Norell, U.: Towards a practical programming language based on dependent type theory. PhD thesis, Chalmers University of Technology and Göteborg University (2007)Google Scholar
  17. [Norvig(1991)]
    Norvig, P.: Techniques for automatic memoization with applications to context-free parsing. Computational Linguistics 17(1), 91–98 (1991)Google Scholar
  18. [Odersky(2009)]
    Odersky, M.: The Scala Language Specification, Version 2.7. Programming Methods Laboratory, EPFL, Switzerland. Draft (2009)Google Scholar
  19. [Paulson et al.(2008)Paulson, Nipkow, and Wenzel]
    Paulson, L.C., Nipkow, T., Wenzel, M.: The Isabelle Reference Manual (2008)Google Scholar
  20. [Pettersson and Fritzson(1992)]
    Pettersson, M., Fritzson, P.: A general and practical approach to concrete syntax objects within ML. In: Proceedings of the ACM SIGPLAN Workshop on ML and its Applications (1992)Google Scholar
  21. [Peyton Jones(2003)]
    Peyton Jones, S. (ed.): Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press, Cambridge (2003)Google Scholar
  22. [Peyton Jones(1986)]
    Peyton Jones, S.L.: Parsing distfix operators. Communications of the ACM 29(2), 118–122 (1986)Google Scholar
  23. [Sterling and Shapiro(1994)]
    Sterling, L., Shapiro, E.: The Art of Prolog, 2nd edn., Advanced Programming Techniques. MIT Press, Cambridge (1994)Google Scholar
  24. [Wadler(1985)]
    Wadler, P.: How to replace failure by a list of successes; a method for exception handling, backtracking, and pattern matching in lazy functional languages. In: Jouannaud, J.-P. (ed.) FPCA 1985. LNCS, vol. 201, pp. 113–128. Springer, Heidelberg (1985)CrossRefGoogle Scholar
  25. [Wansbrough(1999)]
    Wansbrough, K.: Macros and preprocessing in Haskell, unpublished manuscript (1999) Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • Nils Anders Danielsson
    • 1
  • Ulf Norell
    • 2
  1. 1.University of NottinghamUnited Kingdom
  2. 2.Chalmers University of TechnologySweden

Personalised recommendations