Skip to main content

A Language Prototyping Tool Based on Semantic Building Blocks

  • Conference paper
  • First Online:
Computer Aided Systems Theory — EUROCAST 2001 (EUROCAST 2001)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 2178))

Included in the following conference series:

Abstract

We present a Language Prototyping System that facilitates the modular development of interpreters from semantic specifications. The theoretical basis of our system is the integration of ideas from generic programming and modular monadic semantics. The system is implemented as a domain-specific language embedded in Haskell and contains an interactive framework for language prototyping.

In the monadic approach, the semantic spscification of a programming language is captured as a function Σ → MV where Σ represents the abstract syntax, M the computational monad, and V the domain value. In order to obtain more extensibility, we use folds or catamorphisms over the fixpoint of non-recursive pattern functors that capture the structure of the abstract syntax. For each pattern functor F, the semantic specifications are defined as independent F-Algebras whose carrier is M V, where M is the computational monad and V models the domain value. The copmputational monad M can itself be obtained from the composition of several monad transformers applied to a base monad, and the domain value V can be defined using extensible union types.

In this paper, we also show that when the abstract syntax contains several categories, it is possible to define many-sorted algebras obtaining the same modularity.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Language Prototyping System. http://lsi.uniovi.es/~labra/LPS/LPS.html.

  2. D. Álvarez, L. Tajes, F. Álvarez, M. A. Díaz, R. Izquierdo, and J. M. Cueva. An object-oriented abstract machine as the substrate for an object-oriented operating system. In J. Bosch and S. Mitchell, editors, Object Oriented Technology ECOOP’97, Jÿvaskÿla, Finland, June 1997. Springer Verlag, LNCS 1357.

    Google Scholar 

  3. Roland Backhouse, Patrik Jansson, Johan Jeuring, and Lambert Meertens. Generic programming-an introduction. In Swierstra S. D., Henriques P. R., and Oliveira J. N., editors, Advanced Functional Programming, volume 1608 of Lecture Notes in Computer Science. Springer, 1999.

    Google Scholar 

  4. L. S. Barbosa. Components as processes: An exercise in coalgebraic modeling. In S. F. Smith and C. L. Talcott, editors, FMOODS’2000-Formal Methods for Open Object-Oriented Distributed Systems, pages 397–417, Stanford, USA, September 2000. Kluwer Academic Publishers.

    Google Scholar 

  5. N. Benton, J. Hughes, and E. Moggi. Monads and effects. In International Summer School On Applied Semantics APPSEM’2000, Caminha, Portugal, 2000.

    Google Scholar 

  6. R. Bird and Oege de Moor. Algebra of Programming. Prentice Hall, 1997.

    Google Scholar 

  7. Pietro Ceciarelli and Engenio Moggi. A syntactic approach to modularity in denotational semantics. In 5th Biennial Meeting on Category Theory and Computer Science, volume CTCS-5. CWI Technical Report, 1993.

    Google Scholar 

  8. M. A. Díaz, D. Álvarez, A. García-Mendoza, F. Álvarez, L. Tajes, and J. M. Cueva. Merging capabilities with the object model of an object-oriented abstract machine. In S. Demeyer and J. Bosch, editors, Ecoop’98 Workshop on Distributed Object Security, volume 1543, pages 273–276. LNCS, 1998.

    Google Scholar 

  9. Luc Duponcheel. Writing modular interpreters using catamorphisms, subtypes and monad transformers. Utrecht University, 1995.

    Google Scholar 

  10. David Espinosa. Semantic Lego. PhD thesis, Columbia University, 1995.

    Google Scholar 

  11. Maarten M. Fokkinga. Law and Order in Algorithmics. PhD thesis, University of Twente, February 1992.

    Google Scholar 

  12. Maarten M. Fokkinga. Monadic maps and folds for arbitrary datatypes. Memoranda Informatica 94-28, Dept. of Computer Science, Univ. of Twente, June 1994.

    Google Scholar 

  13. Benedict R. Gaster and Mark P. Jones. A Polymorphic Type System for Extensible Records and Variants. Technical Report NOTTCS-TR-96-3, Department of Computer Science, University of Nottingham, November 1996.

    Google Scholar 

  14. William Harrison and Samuel Kamin. Modular compilers based on monad transformers. In Proceedings of the IEEE International Conference on Computer Languages, 1998.

    Google Scholar 

  15. William Harrison and Samuel Kamin. Compilation as metacomputation: Binding time separation in modular compilers. In 5th Mathematics of Program Construction Conference, MPC2000, Ponte de Lima, Portugal, June 2000.

    Google Scholar 

  16. R. Hinze. A generic programming extension for Haskell. In E. Meijer, editor, Proceedings of the 3rd Haskell Workshop, Paris, France, September 1999. The proceedings appear as a technical report of Universiteit Utrecht, UU-CS-1999-28.

    Google Scholar 

  17. Ralf Hinze. Deriving backtracking monad transformers. In Roland Backhouse and J.N. Oliveira, editors, Proceedings of the 2000 International Conference on Functional Programming, Montreal, Canada, September 18–20, 2000, September 2000.

    Google Scholar 

  18. Ralf Hinze. A new approach to generic functional programming. In Conference Record of POPL’00: The 27th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, January 2000.

    Google Scholar 

  19. Z. Hu and H. Iwasaki. Promotional transformation of monadic programs. In Workshop on Functional and Logic Programming, Susono, Japan, 1995. World Scientific.

    Google Scholar 

  20. P. Hudak. Domain-specific languages. In Peter H. Salus, editor, Handbook of Programming Languages, volume III, Little Languages and Tools. Macmillan Technical Publishing, 1998.

    Google Scholar 

  21. H. Iwasaki, Z. Hu, and M. Takeichi. Towards manipulation of mutually recursive functions. In 3rd. Fuji International Symposium on Functional and Logic Programming (FLOPS’98), Kyoto, Japan, 1998. World Scientific.

    Google Scholar 

  22. B. Jacobs and E. Poll. A monad for basic java semantics. In T. Rus, editor, Algebraic Methodology and Software Technology, number 1816 in LNCS. Springer, 2000.

    Chapter  Google Scholar 

  23. Bart Jacobs. Coalgebraic reasoning about classes in object-oriented languages. In Coalgebraic Methods in Computer Science, number 11. Electronic Notes in Computer Science, 1998.

    Google Scholar 

  24. Mark P. Jones. First-class Polymorphism with Type Inference. In Proceedings of the Twenty Fourth Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Paris, France, January 15–17 1997.

    Google Scholar 

  25. Mark P. Jones and L. Duponcheel. Composing monads. YALEU/DCS/RR 1004, Yale University, New Haven, CT, USA, 1993.

    Google Scholar 

  26. S. Kamin. Research on domain-specific embedded languages and program generators. Electronic Notes in Theoretical Computer Science, Elsevier Press, 12, 1998.

    Google Scholar 

  27. Richard B. Kieburtz. Designing and implementing closed domain-specific languages. Invited talk at the Workshop on Semantics, Applications and Implementation of Program Generation (SAIG), 2000.

    Google Scholar 

  28. J. E. Labra. An implementation of modular monadic semantics using folds and monadic folds. In Workshop on Research Themes on Functional Programming, Third International Summer School on Advanced Functional Programming, Braga-Portugal, 1998.

    Google Scholar 

  29. J. E. Labra, J. M. Cueva, and C. Luengo. Language prototyping using modular monadic semantics. In 3rd Latin-American Conference on Functional Programming, Recife-Brazil, March 1999.

    Google Scholar 

  30. Jose E. Labra, Juan M. Cueva, and María C. Luengo. Modular development of interpreters from semantic building blocks. In The 12th Nordic Workshop on Programming Theory, Bergen, Norway, October 2000. University of Bergen.

    Google Scholar 

  31. Sheng Liang. Modular Monadic Semantics and Compilation. PhD thesis, Graduate School of Yale University, May 1998.

    Google Scholar 

  32. Sheng Liang and Paul Hudak. Modular denotational semantics for compiler construction. In Programming Languages and Systems-ESOP’96, Proc. 6th European Symposium on Programming, Linköping, volume 1058 of Lecture Notes in Computer Science, pages 219–234. Springer-Verlag, 1996.

    Google Scholar 

  33. Sheng Liang, Paul Hudak, and Mark P. Jones. Monad transformers and modular interpreters. In 22rd ACM Symposium on Principles of Programming Languages, San Francisco, CA. ACM, January 1995.

    Google Scholar 

  34. Grant Malcolm. Data structures and program transformation. Science of Computer Programming, 14:255–279, 1990.

    Article  MATH  MathSciNet  Google Scholar 

  35. E. Meijer, M. M. Fokkinga, and R. Paterson. Functional programming with bananas, lenses, envelopes and barbed wire. In Functional Programming and Computer Architecture, pages 124–144. Springer-Verlag, 1991.

    Google Scholar 

  36. E. Meijer and J. Jeuring. Merging monads and folds for functional programming. In J. Jeuring and E. Meijer, editors, Advanced Functional Programming, Lecture Notes in Computer Science 925, pages 228–266. Springer-Verlag, 1995.

    Google Scholar 

  37. Erik Meijer. Calculating Compilers. PhD thesis, University of Nijmegen, February 1992.

    Google Scholar 

  38. E. Moggi. Metalanguages and applications. In A. M. Pitts and P. Dybjer, editors, Semantics and Logics of Computation, Publications of the Newton Institute. Cambridge University Press, 1997.

    Google Scholar 

  39. Eugenio Moggi. An abstract view of programming languages. Technical Report ECS-LFCS-90-113, Edinburgh Univ., Dept. of Comp. Sci., June 1989. Lecture Notes for course CS 359, Stanford Univ.

    Google Scholar 

  40. Eugenio Moggi. Notions of computacion and monads. Information and Computation, (93):55–92, 1991.

    Article  MATH  MathSciNet  Google Scholar 

  41. Alberto Pardo. Fusion of monadic (co)recursive programs. In Roland Backhouse and Tim Sheard, editors, Proceedings Workshop on Generic Programming, WGP’98, Marstrand, Sweden, 18 June 1998. Dept. of Computing Science, Chalmers Univ. of Techn., and Göteborg Univ., June 1998.

    Google Scholar 

  42. Tim Sheard and Leonidas Fegaras. A fold for all seasons. In Proceedings 6th ACM SIGPLAN/SIGARCH Intl. Conf. on Functional Programming Languages and Computer Architecture, FPCA’93, Copenhagen, Denmark, 9–11 June 1993, pages 233–242. ACM, New York, 1993.

    Chapter  Google Scholar 

  43. Guy L. Steele, Jr. Building interpreters by composing monads. In Conference record of POPL’ 94, 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages: Portland, Oregon, January 17–21, 1994, pages 472–492, New York, USA, 1994. ACM Press.

    Google Scholar 

  44. L. Tajes, F. Álvarez, D. Álvarez, M. A. Díaz, and J.M. Cueva. A computational model for a distributed object-oriented operating system based on a reflective abstract machine. In S. Demeyer and J. Bosch, editors, Ecoop’98 Workshop on Reflective Object-Oriented Programming and Systems, volume 1543, pages 382–383. LNCS, 1998.

    Chapter  Google Scholar 

  45. Daniele Turi and Jan Rutten. On the foundations of final coalgebra semantics: non-well-founded sets, partial orders, metric spaces. Mathematical Structures in Computer Science, 8(5):481–540, 1998.

    Article  MATH  MathSciNet  Google Scholar 

  46. Arie van Deursen, Paul Klint, and Joost Visser. Domain-specific languages: An annotated bibliography. ACM SIGPLAN Notices, 35(6):26–36, June 2000.

    Article  Google Scholar 

  47. P. Wadler. Comprehending monads. In ACM Conference on Lisp and Functional Programming, pages 61–78, Nice, France, June 1990. ACM Press.

    Google Scholar 

  48. P. Wadler. Monads for functional programming. Lecture notes for Marktoberdorf Summer School on Program Design Calculi, Springer-Verlag, Aug 1992.

    Google Scholar 

  49. P. Wadler. The essence of functional programming. In POPL’ 92, Albuquerque, 1992.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2001 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Labra Gayo, J.E., Cueva Lovelle, J.M., Luengo Díez, M.C., González Rodríguez, B.M. (2001). A Language Prototyping Tool Based on Semantic Building Blocks. In: Moreno-Díaz, R., Buchberger, B., Luis Freire, J. (eds) Computer Aided Systems Theory — EUROCAST 2001. EUROCAST 2001. Lecture Notes in Computer Science, vol 2178. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45654-6_46

Download citation

  • DOI: https://doi.org/10.1007/3-540-45654-6_46

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-42959-3

  • Online ISBN: 978-3-540-45654-4

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics