Let’s start with a teaser: could we add a tiny OCaml interpreter to Numworks (https://www.numworks.com/) graphical calculators?? It should be possible!!
- I’ve been interested in Python and OCaml since the last decade, as most people here.
- I’m highly interested in any project that can allow and help students, who have or want to learn OCaml, to program and write OCaml programs on their own, even if they don’t have a “true laptop” where “true OCaml” can be installed… So I of course love the Android OCaml toplevel by Romain Vernoux (not updated since 2011!), this iOS app announced here a few days ago, and https://BetterOCaml.ml/ and other web-based browser/client-side OCaml interpreters (like TryOCaml). These are great! But I keep in mind that some poor student could not even own a mobile phone, but some of who could already have… a graphic calculator.
- I’ve also kept an eye on the amazing works done by (French!) people at Numworks (https://www.numworks.com/), to develop a graphic programmable calculator, with designs and its operating system, under Creative Commons license (cf. NumWorks · GitHub and the OS at https://github.com/numworks/epsilon).
I’m talking about Numworks here because it embeds a basic Python REPL (using MicroPython, see https://www.numworks.com/fr/ressources/python/, not yet tested myself) and is built by amazing developers using open-source software, and using Python and C++… This could mean that it should be possible to add… a OCaml interpreter to a graphical high-school calculator! How awesome would that be!!
I think the more robust and efficient solution should be to reach them and try to cross-compile the
ocaml compiler (or just the interpreter) to their hardware, but another solution probably easier and faster could be to find an OCaml interpreter written in Python or C++ (even for a tiny subset, no objects no GADT etc, very much like Caml_light).
If anybody is interested in this idea, or knows of projects that could help (ex a tiny-OCaml interpreter written in pure Python3 ?!), please share and discuss below or reach me out directly!
An even more complicated path could be to use
js_of_ocaml(or BuckleScript) to compile the OCaml toplevel/interpreter to WebAssembly, and then a pure-Python interpreter of WebAssembly (like this one
pywasm)… but that’s far fetched!
Or use some idea like this one, and a project like https://github.com/sebmarkbage/ocamlrun-wasm ?