Close

FORTH on the MPF-IP - Part 4 - Compiler Extensions & Recursion

A project log for Exploring the Microprofessor

A journey to explore and better understand the Multitech Microprofessor machines in my retro computer collection

Michael WesselMichael Wessel 02/27/2022 at 04:090 Comments

This time we are covering enough of FORTH to finally succeed at defining recursive words. The video is a bit longer this time (~1 hour), but it is done! If you want to learn how to extend the colon compiler by means of IMMEDIATE / compiling words, how to use COMPILE, LITERAL, and COMMA, and how to execute FORTH at compile time, then this video is for you. I also cover vectored execution, which lets you deal with forward references. We'll discuss various ways to implement a recursive version of the factorial function, and used self-defined defining and compiling words such as LABEL and REC to implement indirect recursion, using the classic ODD / EVEN example. I conclude by giving you some literature pointers and book recommendations. Maybe there will be one more (really final) video, in which I am going to share my version of the "standard" DOER / MAKE constructs - it wasn't easy to port this from Brodie's "Thinking FORTH"to the Microprofessor, so it is worth sharing. Next time though! So stay tuned for one more final video...

Discussions