Compiling OCaml to the TI-84 CE Calculator
Published on: 2025-06-29 05:40:38
In this post, I’ll explain how I compiled an OCaml program to run on a TI-84+ CE calculator. 🐪
Background
OCaml is a somewhat niche functional language that I’ve enjoyed learning over the last couple of years. I’ve also been a calculator enthusiast since high school, working on projects like PineappleCAS. At the time, the calculator toolchain only supported C and (e)z80 assembly. Now, talented folks have set up a toolchain that leverages LLVM so you can program in C, C++, Rust, Zig, and others. OCaml is notably missing from this list. Let’s fix that!
Compiling OCaml
There are native OCaml compilers for x86, ARM, and PowerPC. There is also a bytecode compiler, though it’s largely undocumented (see interp.c). All of these backends need a runtime that includes a garbage collector and native functions to do useful things like print to stdout and read files. Unfortunately, these artifacts tend to be large due to the OCaml compiler’s lack of dead code elimination.
I really like the idea
... Read full article.