Indirect threaded code is quite a universal program representation.
We used to have our Forth-like system back in 1994, with a virtualized NEXT point, so we had execute, interpret, compile and two link stages behaviors for each word. This allowed produce making an optimizing linker, which produced very tiny .COM-files. I still have source code for it.
I think this idea can quite easily be taken to the extreme, and allow adding things like
- type checking
- debugging
- SSA IR generation (say, for LLVM optimizer)
- lots run-time checks (for tests)
So I believe a Forth system can be made quite safe.
We used to have our Forth-like system back in 1994, with a virtualized NEXT point, so we had execute, interpret, compile and two link stages behaviors for each word. This allowed produce making an optimizing linker, which produced very tiny .COM-files. I still have source code for it.
I think this idea can quite easily be taken to the extreme, and allow adding things like - type checking - debugging - SSA IR generation (say, for LLVM optimizer) - lots run-time checks (for tests)
So I believe a Forth system can be made quite safe.