Skip to main content

Transforming Big-Step to Small-Step Semantics Using Interpreter Specialisation

  • Conference paper
  • First Online:
Logic-Based Program Synthesis and Transformation (LOPSTR 2023)

Abstract

Natural semantics (big-step) and structural operational semantics (small-step) each have advantages, so it can be useful to produce both semantic forms for a language. Previous work has shown that big-step semantics can be transformed to small-step semantics. This is also the goal of our work, but our main contribution is to show that this can be done by specialisation of an interpreter that imposes a small-step execution on big-step transition rules. This is arguably more direct, transparent and flexible than previous methods. The paper contains two examples and further examples are available in an online repository.

Partially funded by MICINN projects PID2019-108528RB-C21 ProCode, TED2021-132464B-I00 PRODIGY, and FJC2021-047102-I, and by the Tezos foundation.

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 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.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

Notes

  1. 1.

    https://github.com/jpgallagher/Semantics4PE/tree/main/Big2Small.

References

  1. Ager, M.S.: From natural semantics to abstract machines. In: Etalle, S. (ed.) LOPSTR 2004. LNCS, vol. 3573, pp. 245–261. Springer, Heidelberg (2005). https://doi.org/10.1007/11506676_16

    Chapter  Google Scholar 

  2. Ambal, G., Lenglet, S., Schmitt, A., Noûs, C.: Certified derivation of small-step from big-step skeletal semantics. In: Proceedings of PPDP 2022, pp. 11:1–11:48. ACM (2022). https://doi.org/10.1145/3551357.3551384

  3. Beckman, L., Haraldson, A., Oskarsson, Ö., Sandewall, E.: A partial evaluator, and its use as a programming tool. Artif. Intell. 7(4), 319–357 (1976). https://doi.org/10.1016/0004-3702(76)90011-4

    Article  MATH  Google Scholar 

  4. Blazy, S., Leroy, X.: Mechanized semantics for the Clight subset of the C language. J. Autom. Reasoning 43(3), 263–288 (2009). https://doi.org/10.1007/s10817-009-9148-3

    Article  MathSciNet  MATH  Google Scholar 

  5. Bruynooghe, M., De Schreye, D., Krekels, B.: Compiling control. J. Log. Program. 6(2–3), 135–162 (1989)

    Article  MATH  Google Scholar 

  6. Despeyroux, T.: Executable specification of static semantics. In: Kahn, G., MacQueen, D.B., Plotkin, G. (eds.) SDT 1984. LNCS, vol. 173, pp. 215–233. Springer, Heidelberg (1984). https://doi.org/10.1007/3-540-13346-1_11

    Chapter  MATH  Google Scholar 

  7. Ershov, A.P.: On the partial computation principle. Inf. Process. Lett. 6(2), 38–41 (1977). https://doi.org/10.1016/0020-0190(77)90078-3

    Article  MATH  Google Scholar 

  8. Felleisen, M., Friedman, D.P.: A reduction semantics for imperative higher-order languages. In: de Bakker, J.W., Nijman, A.J., Treleaven, P.C. (eds.) PARLE 1987. LNCS, vol. 259, pp. 206–223. Springer, Heidelberg (1987). https://doi.org/10.1007/3-540-17945-3_12

    Chapter  Google Scholar 

  9. Futamura, Y.: Partial evaluation of computation process - an approach to a compiler-compiler. Syst. Comput. Controls 2(5), 45–50 (1971)

    Google Scholar 

  10. Gallagher, J.P.: Transforming logic programs by specialising interpreters. In: Proceedings of ECAI-86, pp. 109–122 (1986)

    Google Scholar 

  11. Gallagher, J.P., Hermenegildo, M.V., Kafle, B., Klemen, M., López-García, P., Morales, J.F.: From big-step to small-step semantics and back with interpreter specialisation. In: Proceedings of VPT/HCVS@ETAPS 2020. EPTCS, vol. 320, pp. 50–64 (2020). https://doi.org/10.4204/EPTCS.320.4

  12. Giacobazzi, R., Jones, N.D., Mastroeni, I.: Obfuscation by partial evaluation of distorted interpreters. In: PEPM, pp. 63–72. ACM (2012). https://doi.org/10.1145/2103746.2103761

  13. Glück, R.: On the generation of specializers. J. Funct. Program. 4(4), 499–514 (1994). https://doi.org/10.1017/S0956796800001167

    Article  Google Scholar 

  14. Glück, R., Jørgensen, J.: Generating transformers for deforestation and supercompilation. In: Le Charlier, B. (ed.) SAS 1994. LNCS, vol. 864, pp. 432–448. Springer, Heidelberg (1994). https://doi.org/10.1007/3-540-58485-4_57

    Chapter  Google Scholar 

  15. Hermenegildo, M.V., et al.: An overview of Ciao and its design philosophy. Theor. Pract. Logic Program. 12(1–2), 219–252 (2012). https://doi.org/10.1017/S1471068411000457

    Article  MathSciNet  MATH  Google Scholar 

  16. Hill, P.M., Gallagher, J.P.: Handbook of logic in artificial intelligence and logic programming, vol. 5, chap. Meta-Programming in Logic Programming, pp. 421–498. Oxford University Press (1998)

    Google Scholar 

  17. Hill, P.M., Lloyd, J.W.: Analysis of meta-programs. In: Meta-Programming in Logic Programming, pp. 23–51. MIT Press (1988)

    Google Scholar 

  18. Huizing, C., Koymans, R., Kuiper, R.: A small step for mankind. In: Dams, D., Hannemann, U., Steffen, M. (eds.) Concurrency, Compositionality, and Correctness. LNCS, vol. 5930, pp. 66–73. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-11512-7_5

    Chapter  Google Scholar 

  19. Jones, N.D., Gomard, C., Sestoft, P.: Partial Evaluation and Automatic Software Generation. Prent. Hall (1993). https://doi.org/10.1016/j.scico.2004.03.010

    Article  MATH  Google Scholar 

  20. Jones, N.D.: Transformation by interpreter specialisation. Sci. Comput. Program. 52, 307–339 (2004). https://doi.org/10.1016/j.scico.2004.03.010

    Article  MathSciNet  MATH  Google Scholar 

  21. Kahn, G.: Natural semantics. In: Brandenburg, F.J., Vidal-Naquet, G., Wirsing, M. (eds.) STACS 1987. LNCS, vol. 247, pp. 22–39. Springer, Heidelberg (1987). https://doi.org/10.1007/BFb0039592

    Chapter  Google Scholar 

  22. Leuschel, M., Jørgensen, J.: Efficient specialisation in Prolog using the hand-written compiler generator LOGEN. Elec. Notes Theor. Comp. Sci. 30(2) (1999). DOI: https://doi.org/10.1017/S1471068403001662

  23. Lombardi, L.A.: Incremental computation: the preliminary design of a programming system which allows for incremental data assimilation in open-ended man-computer information systems. Adv. Comput. 8, 247–333 (1967). https://doi.org/10.1016/S0065-2458(08)60698-1

    Article  MATH  Google Scholar 

  24. Nielson, H.R., Nielson, F.: Semantics with applications - a formal introduction. Wiley, Wiley professional computing (1992)

    Google Scholar 

  25. Nys, V., De Schreye, D.: Compiling control as offline partial deduction. In: Mesnard, F., Stuckey, P.J. (eds.) LOPSTR 2018. LNCS, vol. 11408, pp. 115–131. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-13838-7_7

    Chapter  Google Scholar 

  26. Plotkin, G.D.: The origins of structural operational semantics. J. Log. Alg. Prog. 60–61, 3–15 (2004). https://doi.org/10.1016/j.jlap.2004.03.009

    Article  MathSciNet  MATH  Google Scholar 

  27. Plotkin, G.D.: A structural approach to operational semantics. J. Log. Alg. Prog. 60–61, 17–139 (2004)

    MathSciNet  MATH  Google Scholar 

  28. Turchin, V.F.: Program transformation by supercompilation. In: Ganzinger, H., Jones, N.D. (eds.) Programs as Data Objects. LNCS, vol. 217, pp. 257–281. Springer, Heidelberg (1986). https://doi.org/10.1007/3-540-16446-4_15

    Chapter  Google Scholar 

  29. Vesely, F., Fisher, K.: One step at a time. In: Caires, L. (ed.) ESOP 2019. LNCS, vol. 11423, pp. 205–231. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-17184-1_8

    Chapter  Google Scholar 

Download references

Acknowledgements

Discussions with Robert Glück, Bishoksan Kafle, Morten Rhiger and Mads Rosendahl are gratefully acknowledged. The paper was improved by the suggestions of the anonymous reviewers.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to John P. Gallagher .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Gallagher, J.P., Hermenegildo, M., Morales, J., Lopez-Garcia, P. (2023). Transforming Big-Step to Small-Step Semantics Using Interpreter Specialisation. In: Glück, R., Kafle, B. (eds) Logic-Based Program Synthesis and Transformation. LOPSTR 2023. Lecture Notes in Computer Science, vol 14330. Springer, Cham. https://doi.org/10.1007/978-3-031-45784-5_3

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-45784-5_3

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-45783-8

  • Online ISBN: 978-3-031-45784-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics