Skip to main content

ICurry

  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNAI,volume 12057))

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

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

Learn about institutional subscriptions

Notes

  1. 1.

    In contrast to some other presentations of FlatCurry (e.g., [1, 18]), we omit the difference between rigid and flexible case expressions.

  2. 2.

    Some implementations of Curry, e.g., [21] perform this transformation.

  3. 3.

    Type-based generators can be implemented with type classes, as described in [23]. Thus, a compiler can easily attach appropriate generators to free variables in ICurry.

  4. 4.

    http://curry-lang.org/tools/cpm.

References

  1. 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)

    Article  MathSciNet  Google Scholar 

  2. 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

    Chapter  Google Scholar 

  3. 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)

    Google Scholar 

  4. Antoy, S.: Evaluation strategies for functional logic programming. J. Symb. Comput. 40(1), 875–903 (2005)

    Article  MathSciNet  Google Scholar 

  5. Antoy, S.: On the correctness of pull-tabbing. TPLP 11(4–5), 713–730 (2011)

    MathSciNet  MATH  Google Scholar 

  6. Antoy, S., Echahed, R., Hanus, M.: A needed narrowing strategy. J. ACM 47(4), 776–822 (2000)

    Article  MathSciNet  Google Scholar 

  7. 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

    Chapter  MATH  Google Scholar 

  8. Antoy, S., Hanus, M.: Functional logic programming. Commun. ACM 53(4), 74–85 (2010)

    Article  Google Scholar 

  9. 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

    Chapter  Google Scholar 

  10. 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)

    Google Scholar 

  11. 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

    Chapter  MATH  Google Scholar 

  12. 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

    Chapter  Google Scholar 

  13. 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

    Chapter  MATH  Google Scholar 

  14. 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)

    Google Scholar 

  15. Caballero, R., Sánchez, J. (eds.): TOY: A Multiparadigm Declarative Language (version 2.3.1) (2007). http://toy.sourceforge.net

  16. Echahed, R., Janodet, J.-C.: On constructor-based graph rewriting systems. Research report IMAG 985-I, IMAG-LSR, CNRS, Grenoble (1997)

    Google Scholar 

  17. Hanus, M.: FlatCurry: an intermediate representation for Curry programs (2008). http://www.informatik.uni-kiel.de/~curry/flat/

  18. 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

    Chapter  MATH  Google Scholar 

  19. 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

    Chapter  MATH  Google Scholar 

  20. 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)

    Google Scholar 

  21. Hanus, M., et al.: PAKCS: The Portland Aachen Kiel Curry System (2018). http://www.informatik.uni-kiel.de/~pakcs/

  22. 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)

    Google Scholar 

  23. Hanus, M., Teegen, F.: Adding Data to Curry. In: Proceedings of the Conference on Declarative Programming (Declare 2019). LNCS. Springer (2019)

    Google Scholar 

  24. 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

    Chapter  Google Scholar 

  25. 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

    Chapter  Google Scholar 

  26. 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

    Chapter  Google Scholar 

  27. O’Donnell, M.J.: Equational Logic as a Programming Language. MIT Press, Cambridge (1985)

    MATH  Google Scholar 

  28. 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)

    Chapter  Google Scholar 

  29. 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)

    Google Scholar 

  30. Wittorf, M.A.: Generic translation of Curry programs into imperative programs. Master’s thesis, Kiel University (2018). (in German)

    Google Scholar 

Download references

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

Authors

Corresponding author

Correspondence to Michael Hanus .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics