Create language kernels for IPython for a language

2019-04-30 20:01发布

问题:

There are some interesting descriptions of writing language kernels to allow a language previously unsupported by IPython to be executed from IPython.

In all cases, the kernel creation step involves using the target language's ZeroMQ bindings (since ZeroMQ is a major architectural component of IPython's front-end to kernel communication protocol).

In my company, a proprietary language was created a few years ago and is maintained with compilers to bytecode (with a bytecode runner written in C++), Flash, and JavaScript ... it's still heavily used today but it has never had anything like a REPL.

This language is a functional language similar to Haskell or SML, and it has no ZeroMQ bindings with no plans for the language maintainers to add any.

Is there a way to still write a kernel that can communicate with IPython?

回答1:

If your language has Python bindings, or you can drive a REPL from Python using something like Pexpect, you can create a wrapper kernel, reusing the IPython communication machinery.

This is documented here: http://ipython.org/ipython-doc/dev/development/wrapperkernels.html