skip to main content
research-article

Iterative type inference with attribute grammars

Published:10 October 2010Publication History
Skip Abstract Section

Abstract

Type inference is the process of constructing a typing derivation while gradually discovering type information. During this process, inference algorithms typically make subtle decisions based on the derivation constructed so far.

Because a typing derivation is a decorated tree we aim to use attribute grammars as the main implementation tool. Unfortunately, we can neither express iteration, nor express decisions based on intermediate derivations in such grammars.

We present the language ruler-front, a conservative extension to ordered attribute grammars, that deals with the aforementioned problems. We show why this extension is suitable for the description of constraint-based inference algorithms.

References

  1. }}B. Arbab. Compiling Circular Attribute Grammars Into Prolog. IBM Journal of Research and Development, 30(3):294--309, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. }}J. T. Boyland. Conditional Attribute Grammars. ACM Transactions on Programming Languages and Systems, 18(1):73--108, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. }}A. Dijkstra and S. D. Swierstra. Typing Haskell with an Attribute Grammar. In AFP, pages 1--72, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. }}A. Dijkstra and S. D. Swierstra. Ruler: Programming Type Rules. In FLOPS, pages 30--46, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. }}A. Dijkstra, J. Fokker, and S. D. Swierstra. The Architecture of the Utrecht Haskell Compiler. In Haskell, pages 93--104, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. }}T. Ekman and G. Hedin. The JastAdd Extensible Java Compiler. In OOPSLA, pages 1--18, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. }}J. Engelfriet and G. Filé. Passes, sweeps, and visits in attribute grammars. Journal of the ACM, 36(4):841--869, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. }}J. Fokker and S. D. Swierstra. Abstract Interpretation of Functional Programs using an Attribute Grammar System. ENTCS, 238(5):117--133, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. }}P. Hudak, S. L. P. Jones, P. Wadler, B. Boutel, J. Fairbairn, J. H. Fasel, M. M. Guzmán, K. Hammond, J. Hughes, T. Johnsson, R. B. Kieburtz, R. S. Nikhil, W. Partain, and J. Peterson. Report on the Programming Language Haskell, A Non-strict, Purely Functional Language. SIGPLAN Notices, 27(5):1--, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. }}L. G. Jones. Efficient Evaluation of Circular Attribute Grammars. ACM Transactions on Programming Languages and Systems, 12(3):429--462, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. }}U. Kastens. Ordered Attributed Grammars. Acta Informatica, 13:229--256, 1980.Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. }}L. C. L. Kats, A. M. Sloane, and E. Visser. Decorated Attribute Grammars: Attribute Evaluation Meets Strategic Programming. In CC, pages 142-- 157, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. }}K. Kennedy and S. K. Warren. Automatic Generation of Efficient Evaluators for Attribute Grammars. In POPL, pages 32--49, 1976. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. }}D. E. Knuth. Semantics of Context-Free Languages. Mathematical Systems Theory, 2(2):127--145, 1968.Google ScholarGoogle ScholarCross RefCross Ref
  15. }}A. Middelkoop, A. Dijkstra, and S. D. Swierstra. Towards Dependently Typed Attribute Grammars. http://people.cs.uu.nl/ariem/ifl10-depend.pdf, 2010a.Google ScholarGoogle Scholar
  16. }}A. Middelkoop, A. Dijkstra, and S. D. Swierstra. Iterative Type Inference with Attribute Grammars. http://people.cs.uu.nl/ariem/ wgt10-journal.pdf, 2010b.Google ScholarGoogle Scholar
  17. }}J. Saraiva. Component-Based Programming for Higher-Order Attribute Grammars. In GPCE, pages 268--282, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. }}J. A. B. V. Saraiva and S. D. Swierstra. Purely Functional Implementation of Attribute Grammars. Technical report, Universiteit Utrecht, 1999.Google ScholarGoogle Scholar
  19. }}S. D. Swierstra and P. R. A. Alcocer. Attribute grammars in the functional style. In Systems Implementation 2000, pages 180--193, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. }}Universiteit Utrecht.Universiteit Utrecht Attribute Grammar System. http://www.cs.uu.nl/wiki/HUT/AttributeGrammarSystem, 1998.Google ScholarGoogle Scholar
  21. }}E. v. Wyk, D. Bodin, J. Gao, and L. Krishnan.Silver: an Extensible Attribute Grammar System. ENTCS, 203(2):103--116, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. }}M. Viera, S. D. Swierstra, and W. Swierstra. Attribute Grammars Fly First-class: how to do Aspect Oriented Programming in Haskell. In ICFP, pages 245--256, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. }}H. Vogt, S. D. Swierstra, and M. F. Kuiper. Higher-Order Attribute Grammars. In PLDI, pages 131--145, 1989.. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Iterative type inference with attribute grammars

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 46, Issue 2
      GPCE '10
      Febuary 2011
      185 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/1942788
      Issue’s Table of Contents
      • cover image ACM Conferences
        GPCE '10: Proceedings of the ninth international conference on Generative programming and component engineering
        October 2010
        198 pages
        ISBN:9781450301541
        DOI:10.1145/1868294
        • General Chair:
        • Eelco Visser,
        • Program Chair:
        • Jaakko Järvi

      Copyright © 2010 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 10 October 2010

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!