RLP Forth - Prototype Proof of Concept
The attached project contains a RLP implementation of a Forth environment. The code can run compiled as well as interactively from a serial terminal.
The Forth VM runs directly on the hardware device by passing the overheads associated with managed code and providing higher performance at the cost of safety. As with native code, you have full access to all parts of the environment so a stray pointer code bring the environment to its knees.
Forth code can be loaded onto the device stored in a resource within your managed application and at the same time you can connect to the device via a serial port and either add new code functionality or completely change/fix existing functionality while the system is running.
The managed code is responsible for initializing the Forth environment and loading code into the environment the code can be stored in a resource, loaded from a SD card or from a string in your managed code.
Once initialized the managed program can interact with the Forth environment by directly manipulating the stack, executing existing words (functions), replace existing words with or create new words. Replacing a word with a new implementation can be done via the interactive interface and compiled on the device directly.
See the sample code to get an idea of what you can do.