Skip to main content
Log in

A Foreign Language Interface from ML to Shell

  • Published:
New Generation Computing Aims and scope Submit manuscript

Abstract

This paper proposes a new approach to embedding shell scripts in an ML-style typed functional language. Instead of representing each construct in the shell script language as a typed component, the proposed approach treats an untyped shell script program as a typed function. The programmer writes a shell script and specifies its type according to the intention of his/her script. The ML compiler automatically generates glue codes that serialize and de-serialize input and output data. With this embedding mechanism, an ML programmer can enjoy the full benefits of shell programming directly within an ML program. The proposed approach has been implemented in our SML# compiler.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Abadi, M., Cardelli, L., Pierce, B. C. and Plotkin, G. D., “Dynamic typing in a statically typed language,” ACM Trans. Program. Lang. Syst., 13, 2, pp. 237–268, 1991.

  2. Heller, A. and Tov, J. A., “Caml-shcaml: an OCaml library for Unix shell programming,” in Proc. of the ACM Workshop on ML, 2008, Victoria, BC, Canada, September 21, 2008 (Sumii, E ed.), pp. 79–90 ACM, 2008.

  3. HSH. http://software.complete.org/hsh.

  4. “ISO/IEC 9945:2009” Information technology - Portable Operating System Interface (POSIX \({^{\textregistered}}\)) Base Specifications, 7, 2009.

  5. Kahn, G., “Natural semantics,” in Proc. Symposium on Theoretical Aspects of Computer Science, pp. 22–39, Springer Verlag, 1987.

  6. Kamath, Y. H. and Matthews, M. M., “Implementation of an fp-shell,” IEEE Trans. Software Eng., 13, 5, pp. 532–539, 1987.

  7. McDonald, C. S., “fsh - a functional UNIX command interpreter,” Softw., Pract. Exper., 17, 10, pp. 685–700, 1987.

  8. Ohori, A. and Kato, K., “Semantics for communication primitives in a polymorphic language,” in POPL ’93: Proc. of the 20th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pp. 99–112, 1993.

  9. Pessaux, F. and Rouaix, F., “The CamlTk interface,” Technical report, INRIA Rocquencourt, 1996.

  10. Plasmeijer, R. and van Weelden, A., “A functional shell that operates on typed and compiled applications,” Advanced Functional Programming, 5 \({^{th}}\) International School, AFP 2004, Tartu, Estonia, August 14–21, 2004, Revised Lectures, LNCS, 3622, pp. 245–272, Springer, 2005.

  11. Shivers, O., “A Scheme shell,” Technical Report LCS/TR-635, Massachusetts Institute of Technology, 1994.

  12. Shultis, J., “A functional shell,” in Proc. of the 1983 ACM SIGPLAN symposium on Programming language issues in software systems, SIGPLAN Not., 18, 6, pp. 202–211, ACM, New York, NY, USA, 1983.

  13. Siek, J. G. and Taha, W., “Gradual typing for functional languages,” in Scheme and Functional Programming Workshop, pp. 81–92, 2006.

  14. SML# compiler. http://www.pllab.riec.tohoku.ac.jp/smlsharp/.

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Katsuhiro Ueno.

Additional information

A preliminary version of this work appeared in pre-proc. of Symposium on Trends in Functional Programming, 2014.

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Ueno, K., Ohori, A. A Foreign Language Interface from ML to Shell. New Gener. Comput. 34, 239–256 (2016). https://doi.org/10.1007/s00354-016-0303-1

Download citation

  • Received:

  • Revised:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00354-016-0303-1

Keywords

Navigation