Model-Driven Engineering from Modular Monadic Semantics: Implementation Techniques Targeting Hardware and Software

  • William L. Harrison
  • Adam M. Procter
  • Jason Agron
  • Garrin Kimmell
  • Gerard Allwein
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5658)


Recent research has shown how the formal modeling of concurrent systems can benefit from monadic structuring. With this approach, a formal system model is really a program in a domain specific language defined by a monad for shared-state concurrency. Can these models be compiled into efficient implementations? This paper addresses this question and presents an overview of techniques for compiling monadic concurrency models directly into reasonably efficient software and hardware implementations. The implementation techniques described in this article form the basis of a semantics-directed approach to model-driven engineering.


Result Register Abstract State Machine Intermediate Language Separation Kernel Algebraic Data Type 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    Ager, M.S., Biernacki, D., Danvy, O., Midtgaard, J.: A functional correspondence between evaluators and abstract machines. In: Proceedings of the 5th ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming (PPDP 2003), pp. 8–19. ACM Press, New York (2003)Google Scholar
  2. 2.
    Ager, M.S., Danvy, O., Midtgaard, J.: A functional correspondence between monadic evaluators and abstract machines for languages with computational effects. Theoretical Computer Science 342(1), 149–172 (2005); Extended version available as BRICS technical report RS-4-28MathSciNetCrossRefzbMATHGoogle Scholar
  3. 3.
    Agron, J.: Domain-specific language for HW/SW co-design for FPGAs. In: Taha, W.M. (ed.) DSL 2009. LNCS, vol. 5658, pp. 262–284. Springer, Heidelberg (2009)Google Scholar
  4. 4.
    Andrews, D., Peck, W., Agron, J., Preston, K., Komp, E., Finley, M., Sass, R.: hthreads: a hardware/software co-designed multithreaded RTOS kernel. In: Proceedings of the 10th IEEE Conference on Emerging Technologies and Factory Automation (ETFA 2005) (September 2005)Google Scholar
  5. 5.
    Appel, A.W.: Compiling with Continuations. Cambridge University Press, Cambridge (1992)Google Scholar
  6. 6.
    Bjesse, P., Claessen, K., Sheeran, M., Singh, S.: Lava: Hardware design in Haskell. In: Proceedings of the Third ACM SIGPLAN International Conference on Functional Programming (ICFP 1998), New York, NY, USA, pp. 174–184 (1998)Google Scholar
  7. 7.
    Dai, J., Huang, B., Li, L., Harrison, L.: Automatically partitioning packet processing applications for pipelined architectures. SIGPLAN Notices 40(6), 237–248 (2005)CrossRefGoogle Scholar
  8. 8.
    Danvy, O., Nielsen, L.R.: Defunctionalization at work. In: Proceedings of the 3rd ACM International Conference on Principles and Practice of Declarative Programming (PPDP 2001), pp. 162–174 (2001)Google Scholar
  9. 9.
    Filinski, A.: Representing layered monads. In: Proceedings of the 26th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 1999), pp. 175–188. ACM Press, New York (1999)CrossRefGoogle Scholar
  10. 10.
    Hammond, K., Michaelson, G.: Hume: A domain-specific language for real-time embedded systems. In: Pfenning, F., Smaragdakis, Y. (eds.) GPCE 2003. LNCS, vol. 2830, pp. 37–56. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  11. 11.
    Harrison, W.: A simple semantics for polymorphic recursion. In: Yi, K. (ed.) APLAS 2005. LNCS, vol. 3780, pp. 37–51. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  12. 12.
    Harrison, W.: The essence of multitasking. In: Johnson, M., Vene, V. (eds.) AMAST 2006. LNCS, vol. 4019, pp. 158–172. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  13. 13.
    Harrison, W., Allwein, G., Gill, A., Procter, A.: Asynchronous exceptions as an effect. In: Audebaud, P., Paulin-Mohring, C. (eds.) MPC 2008. LNCS, vol. 5133, pp. 153–176. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  14. 14.
    Harrison, W., Hook, J.: Achieving information flow security through precise control of effects. In: Proceedings of the 18th IEEE Computer Security Foundations Workshop (CSFW 2005), Aix-en-Provence, France, June 2005, pp. 16–30 (2005)Google Scholar
  15. 15.
    Harrison, W., Hook, J.: Achieving information flow security through monadic control of effects. Journal of Computer Security (invited submission), 51 (2008) (in press); Extends [14]Google Scholar
  16. 16.
    Harrison, W., Kamin, S.: Metacomputation-based compiler architecture. In: Backhouse, R., Oliveira, J.N. (eds.) MPC 2000. LNCS, vol. 1837, pp. 213–229. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  17. 17.
    Harrison, W., Kieburtz, R.: The logic of demand in Haskell. Journal of Functional Programming 15(5), 837–891 (2005)MathSciNetCrossRefzbMATHGoogle Scholar
  18. 18.
    Harrison, W., Procter, A.: Cheap (but functional) threads. Higher-Order and Symbolic Computation, 44 (submitted for publication); extends [12]Google Scholar
  19. 19.
    Hutton, G., Wright, J.: Compiling exceptions correctly. In: Kozen, D. (ed.) MPC 2004. LNCS, vol. 3125, pp. 211–227. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  20. 20.
    Hutton, G., Wright, J.: Calculating an exceptional machine. In: Loidl, H.-W. (ed.) Trends in Functional Programming, February 2006, vol. 5 (2006)Google Scholar
  21. 21.
    Johann, P., Voigtländer, J.: Free theorems in the presence of \(\mathit{seq}\). In: Proceedings of the 31st ACM SIGPLAN Symposum on Principles of Programming Languages, January 2004, pp. 99–110 (2004)Google Scholar
  22. 22.
    Kariotis, P., Procter, A., Harrison, W.: Making monads first-class with Template Haskell. In: Proceedings of the 1st ACM SIGPLAN Symposium on Haskell (Haskell 2008), pp. 99–110 (2008)Google Scholar
  23. 23.
    Kimmell, G.: System Synthesis from a Monadic Functional Language. PhD thesis, University of Kansas (2008)Google Scholar
  24. 24.
    Lawall, J., Muller, G., Duchesne, H.: Language design for implementing process scheduling hierarchies. In: Proceedings of the ACM Symposium on Partial Evaluation and Program Manipulation (PEPM 2004), August 2004, pp. 80–91 (2004)Google Scholar
  25. 25.
    Levis, P., Madden, S., Polastre, J., Szewczyk, R., Whitehouse, K., Woo, A., Gay, D., Hill, J., Welsh, M., Brewer, E., Culler, D.: TinyOS: An operating system for wireless sensor networks. In: Ambient Intelligence. Springer, Heidelberg (2005)Google Scholar
  26. 26.
    Li, P., Zdancewic, S.: Combining events and threads for scalable network services implementation and evaluation of monadic, application-level concurrency primitives. In: Proceedings of the ACM SIGPLAN 2007 Conference on Programming Language Design and Implementation (PLDI 2006), pp. 189–199 (2007)Google Scholar
  27. 27.
    Liang, S., Hudak, P.: Modular denotational semantics for compiler construction. In: Riis Nielson, H. (ed.) ESOP 1996. LNCS, vol. 1058, pp. 219–234. Springer, Heidelberg (1996)CrossRefGoogle Scholar
  28. 28.
    Liang, S., Hudak, P., Jones, M.: Monad transformers and modular interpreters. In: Proceedings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 1995), pp. 333–343. ACM Press, New York (1995)CrossRefGoogle Scholar
  29. 29.
    Matthews, J., Cook, B., Launchbury, J.: Microprocessor Specification in Hawk. In: Proc. of the Intl. Conf. on Computer Languages (ICCL 1998), pp. 90–101 (1998)Google Scholar
  30. 30.
    Minden, G.J., Evans, J.B., Searl, L., DePardo, D., Petty, V.R., Rajbanshi, R., Newman, T., Chen, Q., Weidling, F., Guffey, J., Datla, D., Barker, B., Peck, M., Cordill, B., Wyglinski, A.M., Agah, A.: KUAR: A Flexible Software-Defined Radio Development Platform. In: 2nd IEEE Symposium on New Frontiers in Dynamic Spectrum Access Networks (DySPAN), Dublin, Ireland (April 2007)Google Scholar
  31. 31.
    Moggi, E.: An abstract view of programming languages. Technical Report ECS-LFCS-90-113, Dept. of Computer Science, Edinburgh Univ. (1990)Google Scholar
  32. 32.
    Mycroft, A., Sharp, R.: A statically allocated parallel functional language. In: Welzl, E., Montanari, U., Rolim, J.D.P. (eds.) ICALP 2000. LNCS, vol. 1853, pp. 37–48. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  33. 33.
    Palsberg, J., Ma, D.: A typed interrupt calculus. In: Damm, W., Olderog, E.-R. (eds.) FTRTFT 2002. LNCS, vol. 2469, pp. 291–310. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  34. 34.
    Papaspyrou, N.: A resumption monad transformer and its applications in the semantics of Concurrency. In: Proceedings of the 3rd Panhellenic Logic Symposium (2001); An expanded technical report is available from the author by requestGoogle Scholar
  35. 35.
    Paulson, L.: A semantics-directed compiler generator. In: Proceedings of the 9th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 1982), pp. 224–233 (1982)Google Scholar
  36. 36.
    Peyton Jones, S. (ed.): Haskell 1998 Language and Libraries, Revised Report. Cambridge Univ. Press, Cambridge (2003)zbMATHGoogle Scholar
  37. 37.
    Reynolds, J.: Definitional interpreters for higher order programming languages. In: ACM Conference Proceedings, pp. 717–740 (1972)Google Scholar
  38. 38.
    Roper, M., Olsson, R.: Developing embedded multi-threaded applications with CATAPULTS, a domain-specific language for generating thread schedulers. In: Proceedings of the 2005 International Conference on Compilers, Architectures and Synthesis for Embedded Systems (CASES 2005), pp. 295–303 (2005)Google Scholar
  39. 39.
    Schmidt, D.C.: Model-driven engineering. IEEE Computer 39(2) (February 2006)Google Scholar
  40. 40.
    Sharp, R., Mycroft, A.: The FLaSh compiler: efficient circuits from functional specifications. Technical Report tr.2000.3, AT&T Research (2000)Google Scholar
  41. 41.
    Sheard, T., Benaissa, Z., Pasalic, E.: DSL implementation using staging and monads. In: Proceedings of the 2nd Conference on Domain-Specific Languages, Berkeley, CA, October 3–5, pp. 81–94. USENIX Association (1999)Google Scholar
  42. 42.
    Wand, M.: Semantics-directed machine architecture. In: Proceedings of the 9th ACM SIGPLAN Symposium on Principles of Programming Languages (POPL 1982), pp. 234–241. ACM Press, New York (1982)Google Scholar

Copyright information

© IFIP International Federation for Information Processing 2009

Authors and Affiliations

  • William L. Harrison
    • 1
  • Adam M. Procter
    • 1
  • Jason Agron
    • 2
  • Garrin Kimmell
    • 3
  • Gerard Allwein
    • 4
  1. 1.Department of CSUniversity of MissouriColumbiaUSA
  2. 2.Department of CS & CEUniversity of Arkansas, FayettevilleArkansasUSA
  3. 3.Department of EECSUniversity of Kansas, LawrenceKansasUSA
  4. 4.US Naval Research LaboratoryWashingtonUSA

Personalised recommendations