(c) Andreas Klimas 2017 (w3group, German)
In another series I would show how easy and powerful the programming with FORTH can be.
To extend self written applications (in any programming language) with interactive capabilities (at runtime) could lead in quite interesting features. More powerful testing, debugging and maintenance as well. To have a command line available all the time (even at the customer) could be a striking feature. With such a tool the application can get a preemptive multitasker for free, even for languages which are not capable of doing preemptive multi tasking.
You can download the ANSI-C archive andreas_forth_course.tgz (4k) here.
|⇒ course01||119||Data stack, dictionary, simple interpreter, no string handling|
|⇒ course02||140||little string handling added|
now we get a return stack, a macro dictionary, code segment
and an instruction pointer
The big deal now is that we must have a virtual machine running where the interpreter and compiler is running inside. So we have to compile our first word (I name it shell) by hand
|⇒ course04||304||Add conditions like if and while and unconditional loops|
In the last part we build an disassembler (see |
This course is for educational purpose only. The missing parts are: includes from files (we have stdin only), file handling, exception handling (from the host language and from FORTH itself), debugger (breakpoints, conditional breakpoints, watchpoints, singlestepper) and multitasking (preemptive). Profiling and instrumenting is missing as well.
All these things can be implemented easily and may be I will extend the course further. It depends on the request from the comunnity.
You can email me email@example.com