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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
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
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
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
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
Bruynooghe, M., De Schreye, D., Krekels, B.: Compiling control. J. Log. Program. 6(2–3), 135–162 (1989)
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
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
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
Futamura, Y.: Partial evaluation of computation process - an approach to a compiler-compiler. Syst. Comput. Controls 2(5), 45–50 (1971)
Gallagher, J.P.: Transforming logic programs by specialising interpreters. In: Proceedings of ECAI-86, pp. 109–122 (1986)
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
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
Glück, R.: On the generation of specializers. J. Funct. Program. 4(4), 499–514 (1994). https://doi.org/10.1017/S0956796800001167
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
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
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)
Hill, P.M., Lloyd, J.W.: Analysis of meta-programs. In: Meta-Programming in Logic Programming, pp. 23–51. MIT Press (1988)
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
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
Jones, N.D.: Transformation by interpreter specialisation. Sci. Comput. Program. 52, 307–339 (2004). https://doi.org/10.1016/j.scico.2004.03.010
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
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
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
Nielson, H.R., Nielson, F.: Semantics with applications - a formal introduction. Wiley, Wiley professional computing (1992)
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
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
Plotkin, G.D.: A structural approach to operational semantics. J. Log. Alg. Prog. 60–61, 17–139 (2004)
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
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
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
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
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)