u/benjaminhodgsonin r/ProgrammingLanguages • Recommends
On “Emulating the state of the stack at compile-time using phantom types with Forth as en embedded DSL”
You can do it in a dependently typed system, and it might even be possible (albeit challenging and ugly) in Haskell.
It’s been a while since I watched it, but I seem to remember this lecture series culminating in a verified implementation of an SECD machine.