Advertisement

Attribute grammars in the functional style

  • S. D. Swierstra
  • P. R. Azero
Chapter
Part of the IFIP Advances in Information and Communication Technology book series (IFIPAICT)

Abstract

For a long time, attribute grammars have formed an isolated programming formalism. We show how we may embed the attribute grammar approach in a modern functional programming language. The advantages of both sides reinforce each other: the former provides compositionality and the latter naming abstraction and higher-orderness. Through a sequence of program transformations we show different aspects of the techniques involved. We conclude with the observation that an attribute grammar oriented algorithm development may be a fruitful one, and may go hand in hand with a more algebraic style of program development.

Keywords

attribute grammars functional programming parsing pretty printing 

References

  1. Azero P. and Swierstra S.D. (1997) Design and implementation of a pretty printing library. (In preparation)Google Scholar
  2. Fokker J. (1995) Functional Parsers, in Advanced Functional Programming (eds. J. Jeuring and E. Meijer), LNCS 925. Springer, Berlin.Google Scholar
  3. Gamma E, Helm R., Johnson R. and Vlissides J. (1995) Design Patterns, Addison-Wesley, Reading, Mass.Google Scholar
  4. Hammond K. and Peterson J., eds (1997) Haskell 1.4 Report. Available at: http://haskell.orgGoogle Scholar
  5. Hudak P. (1996) Haskore Music Tutorial, in Advanced Functional Programming: Second International School (eds. J. Launchbury, E. Meijer and T. Sheard), LNCS 1129. Springer, Berlin.Google Scholar
  6. Hughes J. (1995) The design of a pretty-printing library, in Advanced Functional Programming (eds. J. Jeuring and E. Meijer), LNCS 925. Springer, Berlin.Google Scholar
  7. Meijer E., Fokkinga M. and Paterson R. (1991) Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire, in Proceedings of the 5th ACM Conference on Functional Programming Languages and Computer Architecture (ed. J. Hughes).Google Scholar
  8. Jeuring J. and Jansson P. (1996) Polytypic Programming, in Advanced Functional Programming: Second International School (eds. J. Launchbury, E. Meijer and T. Sheard), LNCS 1129. Springer, Berlin.Google Scholar
  9. Swierstra S.D. and de Moor, O. (1993) Virtual Data Structures, in Formal Program Development (eds. B. Möller and H. Partsch and S. Schuman), LNCS 755. Springer, Berlin.Google Scholar
  10. Swierstra S.D. and Duponcheel L. (1996) Deterministic, Error Correcting Combinator Parsers, in Advanced Functional Programming: Second International School (eds. J. Launchbury, E. Meijer and T. Sheard), LNCS 1129. Springer, Berlin.Google Scholar
  11. Wadler P. (1990) Deforestation: Transforming Programs to Eliminate Trees. Theoretical Computer Science, 73, 231–48.zbMATHCrossRefMathSciNetGoogle Scholar

Copyright information

© IFIP 1998

Authors and Affiliations

  • S. D. Swierstra
    • 1
  • P. R. Azero
    • 1
  1. 1.Dept. of Computer ScienceUtrecht UniversityTB UtrechtThe Netherlands

Personalised recommendations