Abstract
FlatCurry is a well-established intermediate representation of Curry programs used in compilers that translate Curry code into Prolog or Haskell code. Some FlatCurry constructs have no direct translation into imperative code. These constructs must be each handled differently when translating Curry code into, e.g., C, or Python code. We introduce a new representation of Curry programs, called ICurry, and derive a translation from all FlatCurry constructs into ICurry. We present the syntax and semantics of ICurry and the translation from FlatCurry to ICurry. We present a model of functional logic computations as graph rewriting and show how this model can be implemented with ICurry in a low-level imperative language.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsNotes
References
Albert, E., Hanus, M., Huch, F., Oliver, J., Vidal, G.: Operational semantics for declarative multi-paradigm languages. J. Symb. Comput. 40(1), 795–829 (2005)
Antoy, S.: Definitional trees. In: Kirchner, H., Levi, G. (eds.) ALP 1992. LNCS, vol. 632, pp. 143–157. Springer, Heidelberg (1992). https://doi.org/10.1007/BFb0013825
Antoy, S.: Constructor-based conditional narrowing. In: Proceedings of the 3rd International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming, PPDP 2001, pp. 199–206. ACM Press (2001)
Antoy, S.: Evaluation strategies for functional logic programming. J. Symb. Comput. 40(1), 875–903 (2005)
Antoy, S.: On the correctness of pull-tabbing. TPLP 11(4–5), 713–730 (2011)
Antoy, S., Echahed, R., Hanus, M.: A needed narrowing strategy. J. ACM 47(4), 776–822 (2000)
Antoy, S., Hanus, M.: Overlapping rules and logic variables in functional logic programs. In: Etalle, S., Truszczyński, M. (eds.) ICLP 2006. LNCS, vol. 4079, pp. 87–101. Springer, Heidelberg (2006). https://doi.org/10.1007/11799573_9
Antoy, S., Hanus, M.: Functional logic programming. Commun. ACM 53(4), 74–85 (2010)
Antoy, S., Hanus, M.: Contracts and specifications for functional logic programming. In: Russo, C., Zhou, N.-F. (eds.) PADL 2012. LNCS, vol. 7149, pp. 33–47. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-27694-1_4
Antoy, S., Hanus, M., Libby, S.: Proving non-deterministic computations in Agda. In: Proceedings of the 24th International Workshop on Functional and (Constraint) Logic Programming, WFLP 2016. Volume 234 of Electronic Proceedings in Theoretical Computer Science, pp. 180–195. Open Publishing Association (2017)
Antoy, S., Jost, A.: A new functional-logic compiler for Curry: Sprite. In: Hermenegildo, M.V., Lopez-Garcia, P. (eds.) LOPSTR 2016. LNCS, vol. 10184, pp. 97–113. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-63139-4_6
Braßel, B., Hanus, M., Peemöller, B., Reck, F.: KiCS2: a new compiler from Curry to Haskell. In: Kuchen, H. (ed.) WFLP 2011. LNCS, vol. 6816, pp. 1–18. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-22531-4_1
Braßel, B., Huch, F.: On a tighter integration of functional and logic programming. In: Shao, Z. (ed.) APLAS 2007. LNCS, vol. 4807, pp. 122–138. Springer, Heidelberg (2007). https://doi.org/10.1007/978-3-540-76637-7_9
Burn, G.L., Peyton Jones, S.L., Robson, J.D.: The spineless G-machine. In: Proceedings of the 1988 ACM Conference on LISP and Functional Programming, pp. 244–258. ACM (1988)
Caballero, R., Sánchez, J. (eds.): TOY: A Multiparadigm Declarative Language (version 2.3.1) (2007). http://toy.sourceforge.net
Echahed, R., Janodet, J.-C.: On constructor-based graph rewriting systems. Research report IMAG 985-I, IMAG-LSR, CNRS, Grenoble (1997)
Hanus, M.: FlatCurry: an intermediate representation for Curry programs (2008). http://www.informatik.uni-kiel.de/~curry/flat/
Hanus, M.: Functional logic programming: from theory to curry. In: Voronkov, A., Weidenbach, C. (eds.) Programming Logics. LNCS, vol. 7797, pp. 123–168. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-37651-1_6
Hanus, M.: Combining static and dynamic contract checking for curry. In: Fioravanti, F., Gallagher, J.P. (eds.) LOPSTR 2017. LNCS, vol. 10855, pp. 323–340. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-94460-9_19
Hanus, M.: Verifying fail-free declarative programs. In: Proceedings of the 20th International Symposium on Principles and Practice of Declarative Programming, PPDP 2018, pp. 12:1–12:13. ACM Press (2018)
Hanus, M., et al.: PAKCS: The Portland Aachen Kiel Curry System (2018). http://www.informatik.uni-kiel.de/~pakcs/
Hanus, M., Skrlac, F.: A modular and generic analysis server system for functional logic programs. In: Proceedings of the ACM SIGPLAN 2014 Workshop on Partial Evaluation and Program Manipulation, PEPM 2014, pp. 181–188. ACM Press (2014)
Hanus, M., Teegen, F.: Adding Data to Curry. In: Proceedings of the Conference on Declarative Programming (Declare 2019). LNCS. Springer (2019)
Kieburtz, R.B.: The G-machine: a fast, graph-reduction evaluator. In: Jouannaud, J.-P. (ed.) FPCA 1985. LNCS, vol. 201, pp. 400–413. Springer, Heidelberg (1985). https://doi.org/10.1007/3-540-15975-4_50
López Fraguas, F.J., Sánchez Hernández, J.: TOY: a multiparadigm declarative system. In: Narendran, P., Rusinowitch, M. (eds.) RTA 1999. LNCS, vol. 1631, pp. 244–247. Springer, Heidelberg (1999). https://doi.org/10.1007/3-540-48685-2_19
José Moreno-Navarro, J., Kuchen, H., Loogen, R.: Lazy narrowing in a graph machine. In: Kirchner, H., Wechler, W. (eds.) ALP 1990. LNCS, vol. 463, pp. 298–317. Springer, Heidelberg (1990). https://doi.org/10.1007/3-540-53162-9_47
O’Donnell, M.J.: Equational Logic as a Programming Language. MIT Press, Cambridge (1985)
Plump, D.: Term graph rewriting. In: Ehrig, H., Engels, G., Kreowski, H.-J., Rozenberg, G. (eds.) Handbook of Graph Grammars and Computing by Graph Transformation, Volume 2: Applications, Languages and Tools, pp. 3–61. World Scientific, Singapore (1999)
Reddy, U.S.: Narrowing as the operational semantics of functional languages. In: Proceedings of the IEEE International Symposium on Logic Programming, Boston, pp. 138–151 (1985)
Wittorf, M.A.: Generic translation of Curry programs into imperative programs. Master’s thesis, Kiel University (2018). (in German)
Acknowledgments
The authors are grateful to the anonymous reviewers for their helpful comments to improve the paper. This material is based in part upon work supported by the National Science Foundation under Grant No. 1317249.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2020 Springer Nature Switzerland AG
About this paper
Cite this paper
Antoy, S., Hanus, M., Jost, A., Libby, S. (2020). ICurry. In: Hofstedt, P., Abreu, S., John, U., Kuchen, H., Seipel, D. (eds) Declarative Programming and Knowledge Management. INAP WLP WFLP 2019 2019 2019. Lecture Notes in Computer Science(), vol 12057. Springer, Cham. https://doi.org/10.1007/978-3-030-46714-2_18
Download citation
DOI: https://doi.org/10.1007/978-3-030-46714-2_18
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-46713-5
Online ISBN: 978-3-030-46714-2
eBook Packages: Computer ScienceComputer Science (R0)