Skip to main content

A Generic Back-End for Exploratory Programming

  • 230 Accesses

Part of the Lecture Notes in Computer Science book series (LNTCS,volume 12834)

Abstract

Exploratory programming is a form of incremental program development in which the programmer can try and compare definitions, receives immediate feedback and can simultaneously experiment with the language, the program and input data. Read-Eval-Print-Loop interpreters (REPLs) and computational notebooks are popular tools for exploratory programming. However, their usability, capabilities and user-friendliness are strongly dependent on the underlying interpreter and, in particular, on the ad hoc engineering required to ready the underlying interpreter for incremental program development. To break this dependency, this paper adopts a principled approach and implements a so-called exploring interpreter as a back-end to support various development environments for exploratory programming.

This paper contributes by presenting a generic Haskell implementation of the exploring interpreter – applicable to a large class of software languages – and demonstrates its usage to develop a variety of interfaces with a shared back-end, including command-line REPLs, computational notebooks and servers with reactive APIs. The design of the back-end is evaluated by defining a variety of interfaces for existing languages, including eFLINT, a domain-specific language for normative reasoning, and Funcons-beta, the language developed by the PLanCompS project to enable component-based operational semantics.

Keywords

  • Interpreters
  • Development environments
  • Operational semantics
  • Read-Eval-Print
  • Definitional interpreters

This is a preview of subscription content, access via your institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • DOI: 10.1007/978-3-030-83978-9_2
  • Chapter length: 20 pages
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
eBook
USD   39.99
Price excludes VAT (USA)
  • ISBN: 978-3-030-83978-9
  • Instant PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
Softcover Book
USD   49.99
Price excludes VAT (USA)
Fig. 1.
Fig. 2.
Fig. 3.
Fig. 4.
Fig. 5.
Fig. 6.
Fig. 7.

Notes

  1. 1.

    A definitional interpreter for a language is an interpreter that simultaneously implements and defines the language’s operational semantics, often defined in a meta-language or language workbench in the context of domain-specific languages.

  2. 2.

    https://hackage.haskell.org/package/fgl.

  3. 3.

    https://hackage.haskell.org/package/exploring-interpreters.

  4. 4.

    https://gitlab.com/eflint/haskell-implementation.

  5. 5.

    https://github.com/plancomps/funcons-tools.

  6. 6.

    http://plancomps.org.

  7. 7.

    https://plancomps.github.io/CBS-beta/Funcons-beta/Funcons-Index/.

  8. 8.

    With the exception of the node itself, in case of a cycle.

References

  1. Astesiano, E.: Inductive and operational semantics. In: Neuhold, E., Paul, M. (eds.) IFIP State-of-the-Art Reports, Formal Descriptions of Programming Concepts, pp. 51–136. Springer (1991). ISBN: 978-3-540-53961-2

    Google Scholar 

  2. Bach Poulsen, C., Mosses, P.D.: Generating specialized interpreters for modular structural operational semantics. In: Gupta, G., Peña, R. (eds.) LOPSTR 2013. LNCS, vol. 8901, pp. 220–236. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-14125-1_13

    CrossRef  Google Scholar 

  3. Beth Kery, M., Myers, B.A.: Exploring exploratory programming. In: 2017 IEEE Symposium on Visual Languages and Human-Centric Computing (VL/HCC), pp. 25–29 (2017). https://doi.org/10.1109/VLHCC.2017.8103446

  4. van Binsbergen, L.T.: Funcons for HGMP: the fundamental constructs of homogeneous generative meta-programming (short paper). In: Proceedings of the 17th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experience. GPCE 2018 (2018). https://doi.org/10.1145/3278122.3278132

  5. van Binsbergen, L.T.: Executable Formal Specification of Programming Languages with Reusable Components. Ph.D. thesis, Royal Holloway, University of London (2019)

    Google Scholar 

  6. van Binsbergen, L.T., Liu, L., van Doesburg, R., van Engers, T.: eFLINT: a domain-specific language for executable norm specifications. In: Proceedings of the 19th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences. GPCE 2020. ACM (2020)

    Google Scholar 

  7. van Binsbergen, L.T., Mosses, P.D., Sculthorpe, N.: Executable component-based semantics. J. Logical Algebraic Methods Program. 103, 184–212 (2019). https://doi.org/10.1016/j.jlamp.2018.12.004

    MathSciNet  CrossRef  MATH  Google Scholar 

  8. van Binsbergen, L.T., Verano Merino, M., Jeanjean, P., van der Storm, T., Combemale, B., Barais, O.: A Principled Approach to REPL Interpreters, pp. 84–100. ACM (2020). https://doi.org/10.1145/3426428.3426917

  9. Bousse, E., Leroy, D., Combemale, B., Wimmer, M., Baudry, B.: Omniscient debugging for executable DSLs. J. Syst. Softw. 137, 261–288 (2018)

    CrossRef  Google Scholar 

  10. Churchill, M., Mosses, P.D., Sculthorpe, N., Torrini, P.: Reusable components of semantic specifications. In: Transactions on Aspect-Oriented Software Development XII. TAOSD 2015, pp. 132–179 (2015)

    Google Scholar 

  11. Erdweg, S., et al.: Evaluating and comparing language workbenches: existing results and benchmarks for the future. Comput. Lang. Syst. Struct. 44, 24–47 (2015)

    Google Scholar 

  12. Goguen, J.A., Thatcher, J.W., Wagner, E.G., Wright, J.B.: Initial algebra semantics and continuous algebras. J. ACM 24(1), 68–95 (1977)

    MathSciNet  CrossRef  Google Scholar 

  13. Hayes, B.: Thoughts on Mathematica. Pixel 1(January/February), pp. 28–34 (1990)

    Google Scholar 

  14. Hudak, P., Hughes, J., Peyton Jones, S., Wadler, P.: A history of haskell: being lazy with class. In: Proceedings of the Third ACM SIGPLAN Conference on History of Programming Languages. HOPL III. ACM (2007). https://doi.org/10.1145/1238844.1238856

  15. Kahn, G.: Natural semantics. In: Proceedings of the 4th Annual Symposium on Theoretical Aspects of Computer Science. pp. 22–39. Springer-Verlag (1987)

    Google Scholar 

  16. Kats, L.C.L., Visser, E.: The Spoofax language workbench: Rules for declarative specification of languages and IDEs. In: International Conference on Object Oriented Programming Systems Languages and Applications. OOPSLA 2010, pp. 444–463. ACM (2010). https://doi.org/10.1145/1869459.1869497

  17. Klint, P., Storm, T.v.d., Vinju, J.: Rascal: A domain specific language for source code analysis and manipulation. In: Proceedings of the 2009 Ninth IEEE International Working Conference on Source Code Analysis and Manipulation, pp. 168–177. IEEE Computer Society (2009). https://doi.org/10.1109/SCAM.2009.28

  18. Kluyver, T., et al.: J development team: Jupyter notebooks - a publishing format for reproducible computational workflows. In: Loizides, F., Scmidt, B. (eds.) Positioning and Power in Academic Publishing: Players, Agents and Agendas, pp. 87–90. IOS Press, Netherlands (2016). https://doi.org/10.3233/978-1-61499-649-1-87

  19. Lazar, D., et al.: Executing formal semantics with the \(\mathbb{K}\) tool. In: Giannakopoulou, D., Méry, D. (eds.) FM 2012. LNCS, vol. 7436, pp. 267–271. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-32759-9_23

    CrossRef  Google Scholar 

  20. Lewis, B.: Debugging backwards in time. Computing Research Repository cs.SE/0310016 (2003). http://arxiv.org/abs/cs/0310016

  21. Liang, S., Hudak, P., Jones, M.: Monad transformers and modular interpreters. In: 22nd Symposium on Principles of Programming Languages, pp. 333–343. ACM (1995)

    Google Scholar 

  22. Lienhard, A., Gîrba, T., Nierstrasz, O.: Practical object-oriented back-in-time debugging. In: Vitek, J. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 592–615. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-70592-5_25

    CrossRef  Google Scholar 

  23. Marlow, S.: Haskell 2010 Language Report (2010)

    Google Scholar 

  24. Milner, R., Tofte, M., MacQueen, D.: The Definition of Standard ML. MIT Press, Cambridge (1997)

    Google Scholar 

  25. Moggi, E.: Notions of computation and monads. Inf. Comput. 93(1), 55–92 (1991). https://doi.org/10.1016/0890-5401(91)90052-4

    MathSciNet  CrossRef  MATH  Google Scholar 

  26. Mosses, P.D.: Modular structural operational semantics. J. Logic Algebraic Program. 60–61, 195–228 (2004)

    MathSciNet  CrossRef  Google Scholar 

  27. Mosses, P.D.: Software meta-language engineering and CBS. J. Comput. Lang. 50, 39–48 (2019). https://doi.org/10.1016/j.jvlc.2018.11.003

    CrossRef  Google Scholar 

  28. Mosses, P.D., New, M.J.: Implicit propagation in structural operational semantics. Electron. Notes Theoretical Comput. Sci. 229(4), 49–66 (2009)

    CrossRef  Google Scholar 

  29. Oliveira, B.C.S., Cook, W.R.: Extensibility for the masses. In: Noble, J. (ed.) ECOOP 2012. LNCS, vol. 7313, pp. 2–27. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-31057-7_2

    CrossRef  Google Scholar 

  30. Peyton Jones, S. (ed.): Haskell 98, Language and Libraries. The Revised Report. Cambridge University Press (2003)

    Google Scholar 

  31. Pickering, M., Wu, N., Kiss, C.: Multi-stage programs in context. In: Eisenberg, R.A. (ed.) Proceedings of the 12th ACM SIGPLAN International Symposium on Haskell, Haskell@ICFP 2019, Berlin, Germany, pp. 71–84. ACM (2019). https://doi.org/10.1145/3331545.3342597

  32. Pimentel, J.F., Murta, L., Braganholo, V., Freire, J.: A large-scale study about quality and reproducibility of Jupyter notebooks. In: 2019 IEEE/ACM 16th International Conference on Mining Software Repositories (MSR), pp. 507–517 (2019)

    Google Scholar 

  33. Plotkin, G., Pretnar, M.: Handlers of algebraic effects. In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 80–94. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-00590-9_7

    CrossRef  Google Scholar 

  34. Plotkin, G.D.: A structural approach to operational semantics. J. Logic Algebraic Program. 60–61, 17–139 (2004)

    MathSciNet  MATH  Google Scholar 

  35. Pothier, G., Tanter, É., Piquer, J.: Scalable omniscient debugging. ACM SIGPLAN Notices 42(10), 535–552 (2007). https://doi.org/10.1145/1297105.1297067

    CrossRef  Google Scholar 

  36. Rein, P., Ramson, S., Lincke, J., Hirschfeld, R., Pape, T.: Exploratory and live, programming and coding. Art Sci. Eng. Program. 3(1), 1–32 (2018). https://doi.org/10.22152/programming-journal.org/2019/3/1

  37. Reynolds, J.C.: Definitional interpreters for higher-order programming languages. In: Proceedings of the ACM Annual Conference, vol. 2, pp. 717–740 (1972)

    Google Scholar 

  38. Reynolds, J.C.: Definitional interpreters for higher-order programming languages. High. Order Symbol. Comput. 11(4), 363–397 (1998)

    CrossRef  Google Scholar 

  39. Reynolds, J.C.: Definitional interpreters revisited. High. Order and Symbol. Comput. 11(4), 355–361 (1998)

    CrossRef  Google Scholar 

  40. Rouvoet, A., Bach Poulsen, C., Krebbers, R., Visser, E.: Intrinsically-typed definitional interpreters for linear, session-typed languages. In: Proceedings of the 9th ACM SIGPLAN International Conference on Certified Programs and Proofs (CPP 2020), pp. 284–298 (2020). https://doi.org/10.1145/3372885.3373818

  41. Rule, A., Tabard, A., Hollan, J.D.: Exploration and explanation in computational notebooks. In: Proceedings of the 2018 CHI Conference on Human Factors in Computing Systems. CHI 2018, pp. 1–12. ACM (2018)

    Google Scholar 

  42. Sewell, P., et al.: Ott: effective tool support for the working semanticist. J. Func. Program. 20(1), 71–122 (2010). https://doi.org/10.1017/S0956796809990293

    CrossRef  MATH  Google Scholar 

  43. Swierstra, S.D., Azero Alcocer, P.R., Saraiva, J.: Designing and implementing combinator languages. In: Swierstra, S.D., Oliveira, J.N., Henriques, P.R. (eds.) AFP 1998. LNCS, vol. 1608, pp. 150–206. Springer, Heidelberg (1999). https://doi.org/10.1007/10704973_4

    CrossRef  Google Scholar 

  44. Swierstra, W.: Data types à la carte. J. Func. Program. 18(4), 423–436 (2008). https://doi.org/10.1017/S0956796808006758

    MathSciNet  CrossRef  MATH  Google Scholar 

  45. Trenouth, J.: A survey of exploratory software development. Comput. J. 34(2), 153–163 (1991). https://doi.org/10.1093/comjnl/34.2.153

    CrossRef  Google Scholar 

  46. Van Wyk, E., de Moor, O., Backhouse, K., Kwiatkowski, P.: Forwarding in attribute grammars for modular language design. In: Horspool, R.N. (ed.) CC 2002. LNCS, vol. 2304, pp. 128–142. Springer, Heidelberg (2002). https://doi.org/10.1007/3-540-45937-5_11

    CrossRef  Google Scholar 

  47. Vergu, V.A., Neron, P., Visser, E.: DynSem: a DSL for dynamic semantics specification. In: 26th International Conference on Rewriting Techniques and Applications, RTA 2015. Leibniz International Proceedings in Informatics, vol. 36, pp. 365–378. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2015)

    Google Scholar 

  48. Walicki, M., Meldal, S.: Algebraic approaches to nondeterminism - an overview. ACM Comput. Surv. 29(1), 30–81 (1997)

    CrossRef  Google Scholar 

  49. Wu, N., Schrijvers, T., Hinze, R.: Effect handlers in scope. In: Proceedings of the 2014 ACM SIGPLAN Symposium on Haskell. Haskell 2014, pp. 1–12. ACM (2014)

    Google Scholar 

Download references

Acknowledgements

The work in this paper has been partially supported by the Kansen Voor West EFRO project (KVW00309) AMdEX Fieldlab, the NWO project (628.009.014) Secure Scalable Policy-enforced Distributed Data Processing (SSPDDP) and has been executed in a collaboration with the Agile Language Engineering (ALE) team (http://gemoc.org/ale/).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Damian Frolich .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and Permissions

Copyright information

© 2021 Springer Nature Switzerland AG

About this paper

Verify currency and authenticity via CrossMark

Cite this paper

Frolich, D., van Binsbergen, L.T. (2021). A Generic Back-End for Exploratory Programming. In: Zsók, V., Hughes, J. (eds) Trends in Functional Programming. TFP 2021. Lecture Notes in Computer Science(), vol 12834. Springer, Cham. https://doi.org/10.1007/978-3-030-83978-9_2

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-83978-9_2

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-83977-2

  • Online ISBN: 978-3-030-83978-9

  • eBook Packages: Computer ScienceComputer Science (R0)