Skip to main content
×
×
Home

Embedding an interpreted language using higher-order functions and types

  • NORMAN RAMSEY (a1)
Abstract

Using an embedded, interpreted language to control a complicated application can have significant software-engineering benefits. But existing interpreters are designed for embedding into C code. To embed an interpreter into a different language requires an API suited to that language. This paper presents Lua-ML, a new API that is suited to languages that provide higher-order functions and types. The API exploits higher-order functions and types to reduce the amount of glue code needed to use an embedded interpreter. Where embedding in C requires a special-purpose “glue function” for every function to be embedded, embedding in Lua-ML requires only a description of each function's type. Lua-ML also makes it easy to define a Lua function whose behavior depends on the number and types of its arguments.

Copyright
References
Hide All
Beazley, D. M. (1996) SWIG: An easy to use tool for integrating scripting languages with C and C++. In Proceedings of the Fourth Annual Tcl/Tk Workshop, USENIX (ed). Berkeley, CA: USENIX, pp. 129139.
Benson, B. W. (October 1994) Libscheme: Scheme as a C library. In Proceedings of the USENIX Symposium on Very High Level Languages, pp. 7–19.
Benton, N. (July 2005) Embedded interpreters. J. Funct. Program. 15 (4), 503542.
Blume, M. (September 2001) No-longer-foreign: Teaching an ML compiler to speak C “natively”. In Proceedings of the First Workshop on Multi-Language Infrastructure and Interoperability (BABEL '01).
Celes, W. (March 2003) toLua–Accessing C/C++ code from Lua [online]. Accessed August 29, 2011. Available at: http://www.tecgraf.puc-rio.br/~celes/tolua
Danvy, O. (1996) Type-directed partial evaluation. In Proceedings of the Conference Record of the 23rd Annual ACM Symposium on Principles of Programming Languages, pp. 242–257.
Danvy, O. (1998) A simple solution to type specialization. In Proceedings of the 25th International Colloquium on Automata, Languages, and Programming (ICALP), Lecture Notes in Computer Science, vol. 1443. Springer-Verlag, pp. 908917.
Fokker, J. (1995) Functional parsers. In Advanced Functional Programming, Jeuring, J. & Erik, M. (eds), Lecture Notes in Computer Science, vol. 925. Springer Verlag, pp. 123.
Ierusalimschy, R. (December 2003) Programming in Lua. Lua.org. ISBN 85-903798-1-7.
Ierusalimschy, R., de Figueiredo, L. H. & Celes, W. (June 1996a) Lua–An extensible extension language. Softw. Pract. Exp. 26 (6), 635652.
Ierusalimschy, R., de Figueiredo, L. H. & Celes, W. (November 1996b)s Reference Manual of the Programming Language Lua 2.5. TeCGraf, PUC-Rio. Available from the author.
Ierusalimschy, R., de Figueiredo, L. H. & Celes, W. (October 2000) Reference Manual of the Programming Language Lua 4.0. TeCGraf, PUC-Rio. Available at: http://www.lua.org
Ierusalimschy, R., de Figueiredo, L. H. & Celes, W. (May 2001) The evolution of an extension language: A history of Lua. In Proceedings of the V Brazilian Symposium on Programming Languages, pp. B14–B28. Invited paper.
Ierusalimschy, R., de Figueiredo, L. H. & Celes, W. (June 2007) The evolution of Lua. In Proceedings of the Third ACM SIGPLAN Conference on History of Programming Languages, pp. 2-1–2-26.
Jenness, T. & Cozens, S. (July 2002) Extending and Embedding Perl. Manning Publications Company.
Jeske, D. (1998) ***Hz–A real-time action strategy engine [online]. Unpublished software. Accessed August 29, 2011. Available at: http://dj1.willowmail.com/~jeske/Projects/HZ/
Laumann, O. & Bormann, C. (Fall 1994) Elk: The extension language kit. Comput. Syst. 7 (4), 419449.
Leijen, D. & Meijer, E. (January 2000) Domain-specific embedded compilers. Proceedings of the 2nd Conference on Domain-Specific Languages, in SIGPLAN Not. 35 (1), 109122.
Leroy, X., Doligez, D., Garrigue, J., Rémy, D. & Vouillon, J. (July 2004) The Objective Caml system release 3.08: Documentation and user's manual. INRIA. Available at: http://pauillac.inria.fr/ocaml/htmlman
Liang, S., Hudak, P. & Jones, M. (1995) Monad transformers and modular interpreters. In Proceedings of the Conference Record of the 22nd Annual ACM Symposium on Principles of Programming Languages, pp. 333–343.
Libes, D. (December 1994) Exploring Expect: A Tcl-based Toolkit for Automating Interactive Programs. pub-ORA:adr: O'Reilly & Associates, Inc.
Mogilefsky, B. (May 1999) Lua in Grim Fandango [online]. Accessed July 2011. Available at: http://www.grimfandango.net/?page=articles&pagenumber=2
Olinsky, R., Lindig, C. & Ramsey, N. (January 2006) Staged allocation: A compositional technique for specifying and implementing procedure calling conventions. In Proceedings of the 33rd ACM Symposium on the Principles of Programming Languages, pp. 409–421.
Ousterhout, J. K. (January 1990) Tcl: An embeddable command language. In Proceedings of the Winter USENIX Conference, pp. 133–146.
Ousterhout, J. K. (1994) Tcl and the Tk Toolkit. Professional Computing Series. Reading, MA: Addison-Wesley.
Peyton Jones, S. L., Ramsey, N. & Reig, F. (September 1999) C--: A portable assembly language that supports garbage collection. In Proceedings of the International Conference on Principles and Practice of Declarative Programming, Lecture Notes in Computer Science, vol. 1702. Springer Verlag, pp. 128.
Ramsey, N. (June 2003) Embedding an interpreted language using higher-order functions and types. In Proceedings of the ACM Workshop on Interpreters, Virtual Machines, and Emulators, pp. 6–14.
Ramsey, N. (September 2005) ML module mania: A type-safe, separately compiled, extensible interpreter. In Proceedings of the ACM SIGPLAN Workshop on ML, pp. 172–202.
Ramsey, N. & Peyton Jones, S. L.. (May 2000) A single intermediate language that supports multiple implementations of exceptions. Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, in SIGPLAN Not. 35 (5), 285298.
Rhiger, M. (May 2003) A foundation for embedded languages. ACM Trans. Program. Lang. Syst. 25 (3), 291315.
Siefkes, C., Assis, F., Chhabra, S. & Yerazunis, W. S. (2004) Combining winnow and orthogonal sparse bigrams for incremental spam filtering. In Proceedings of the 8th European Conference on Principles and Practice of Knowledge Discovery in Databases, Lecture Notes in Computer Science, vol. 3202. Springer, pp. 410421.
van Rossum, G. (2002) Extending and Embedding the Python Interpreter. Release 2.2.2.
Yang, Z. (January 1999) Encoding types in ML-like languages. Proceedings of the 1998 ACM SIGPLAN International Conference on Functional Programming, in SIGPLAN Not. 34 (1), 289300.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Journal of Functional Programming
  • ISSN: 0956-7968
  • EISSN: 1469-7653
  • URL: /core/journals/journal-of-functional-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *
×
Type Description Title
UNKNOWN
Supplementary Data

Ramsey Supplementary Data
Ramsey Supplementary Data

 Unknown (183 KB)
183 KB

Metrics

Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed

Embedding an interpreted language using higher-order functions and types

  • NORMAN RAMSEY (a1)
Submit a response

Discussions

No Discussions have been published for this article.

×

Reply to: Submit a response


Your details


Conflicting interests

Do you have any conflicting interests? *