Could we add a tiny OCaml interpreter to Numworks graphical calculators?

Hello there,
Let’s start with a teaser: could we add a tiny OCaml interpreter to Numworks ( 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 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 (, to develop a graphic programmable calculator, with designs and its operating system, under Creative Commons license (cf. NumWorks · GitHub and the OS at

:thinking: I’m talking about Numworks here because it embeds a basic Python REPL (using MicroPython, see, 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… :tada: 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).

I already emailed the Numworks team about that idea. (it would also be awesome to add a Javascript interpreter, as this could directly bring OCaml thanks to js_of_ocaml !)

:cry: I’ve looked deeply on Internet, and found at least two projects that tried to do the opposite, interpreting Python in OCaml (project 1 project 2 “minipy”)… but of course the converse is harder!

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 ?

1 Like

Many students are also using other calculators like Texas Instruments or Casio, and some of them already support Python. That way, making an OCaml interpreter in pure python would allow to extend this project to many more calculators (all the people in my school actually own a Texas Instruments or Casio, I don’t know a lot of people with Numworks calculators)

Hi, first let me say that–your goal is praiseworthy–trying to get OCaml shipped in more devices is great of course.

Having said that, we should recognize that the market of people who would buy this graphing calculator, at a price point of $99, would probably be more well-to-do people. If I were a poor kid who didn’t have a mobile phone, but had $99, I would buy a cheap Android phone like (or even cheaper to allocate some of that to a data plan–but chances are that I would also be able to use my school or college wifi network). Having a phone would be a higher priority than having a graphing calculator.

Again, this is not to detract from your effort, which is really cool, but to think about who would use this device.

1 Like

Thanks for your remark, I was of course expecting that someone would bring this argument, and you’re perfectly right!
Nothing to add here, I guess my excitement is more justified by pure curiosity and “geekiness” than real pragmatic philanthropy.

1 Like

Another justification for this effort could be to not aim at students already learning OCaml, but all the high-school students who could get curious about OCaml (or Javascript) if their calculator was shiping a tiny interpreter for another language!
Numworks sells calculators in different countries already (apparently, from their websites), and to a much larger number of students than students in CPGE in France who are learning OCaml (between 1500 and 3000 at most each year, which still is enough to motivate works like, IMHO).

Thanks Nathan, for the interesting arguments.

  • Indeed, adding a tiny OCaml (or/and Javascript) interpreter to the Python-ready Casio as well as TI calculators could be awesome too. I think my effort will focus on Numworks first, because the team is French and already loves Open-Source!
  • I’m not surprised that Numworks calculators are not (yet) so popular in CPGE.

Have you thought about cross compile caml-light? It’s runtime is in C and has only byte code interpreter.

There is also mini-ocaml for boostrapping purposes: GitHub - Ekdohibs/camlboot: Experiment on how to bootstrap the OCaml compiler

1 Like

From Software Engineering — Engineering — Resources — NumWorks

Our device has 256 KB of RAM.

We booked 32KB for the stack.

Completely unusable. Early versions of Caml Light did run on 640k PCs with MSDOS, but 256k is beyond hope. A simple interpreted Lisp, perhaps. Forget about Python, too.

I support @yawaramin 's suggestion of a cheap Android phone or tablet. The hardware is tremendously more powerful and software is portable across many devices.


Thanks @xavierleroy for your valuable insights. I was indeed afraid the hardware of Numworks calculators would be too limited to run a Caml_light or OCaml interpreter.
However, regarding Python, it’s already available on the devices! It uses MicroPython, and it works very well!
The OS of the calculator can be tested online:

1 Like

I knew that Python had to be interpreted on microcontrollers, and tiny CPU/RAM (Yet it is compact enough to fit and run within just 256k of code space and 16k of RAM.), but I just discovered that JavaScript has! I’m unable to find the minimal requirements, but it’s probably explained in the FAQ?

1 Like