Benutzer-Werkzeuge

Webseiten-Werkzeuge


projects:forth-namespaces:start

**Dies ist eine alte Version des Dokuments!**

Forth Namespaces and Context Switching based on VOCs, ITEMs and STICKY Words

In Forth namespaces and context switching are based on wordlists, search orders and vocabularies.

Using namespaces is encouraging concerning factoring of code into well structured source code modules and context switching could be used to define data types or simple objects. Both can make programing much more fun and can help to write readable and well structured code.

Since I discovered Forth and became familiar with the vocabulary concepts of Fig-Forth and F83, I was missing a way to bind a vocabulary (a namespace, a wordlist) to a word representing data, to create a data type or a simple object (implicit context switching).

Over the years I found a way to do it without using state-smart words, first for PC Forth Systems and during the last years also for Flash based MCU Forth Systems. VOCs, ITEMs and STICKY words are the core elements of the final concept.

With this Wiki page I will try to beam your attention towards context switching with VOCs, ITEMs and STICKY words by presenting Forth Systems that support it, examples and HOWTOs.

2019-12-18 Manfred Mahlow

430eForth43n6vis

430eForth43n6vis [1] for the MSP430G2553 MCU is a tiny Forth System with full support for namespaces and context switching based on VOCs, ITEMs and STICKY words [2]. It is an extended version of C.H. Tings 430eForth for the MSP430G2553 MCU, based on the naken_ASM version published by M. Kalus on GitHub.

430eForth43n6vis was created as part of a feasibility study how to extend the support for namespaces in Forth by implementing vocabulary prefixes (VOC) instead of F83 vocabularies (VOCABULARY) [3]. Wordlists, vocabulary prefixes (VOCs), <voc> ITEMs, STICKY words and related TOOLS have been added and two search orders are used, a permanent and a temporary one. For further details please read the README file that comes with the tar archive.

430eForth and Tools : 430eforth43n6vis-g2553.tar.gz (191217)

Examples and HOWTOs : 430eforth43n6vis-g2553-examples.tar.gz (191217)

[1] Namespaces and Context Switching for a Tiny Forth, VD 4/2019

[2] VOCs ITEMS und STICKY Words, Forth Tagung 2019

[3] VOC statt VOCABULARY, Forth Tagung 2019

Mecrisp-Stellaris

Mecrisp-Stellaris was a very special candidate to add namespaces and context switching because of its special features and the many different supported targets [4]. So I decided not to add the required modifications and extensions to the Mecrisp-Stellaris Core but to concentrate all into an external source code file, to be loaded on demand. Only one hook, called HOOK-FIND, added by Matthias Koch, is used, to link the extension into the Mecrisp Core.

The extension adds support for wordlists, vocabulary prefixes (VOCs), implicit context switching words (ITEMs), STICKY words and related TOOLS.

The source code file vis-x.y.z-mecrisp-stellaris.txt can be downloaded with vis-mecrisp-stellaris.tar.gz (220505)

The extension is compiled to FLASH. Before loading the file execute eraseflash to reset Mecrisp-Stellaris to its original state.

The extension should work for most Mecrisp-Stellaris flavors. The only requirement is, that the header of a word compiled into FLASH (or RAM) is placed without a gap behind the last comma-compiled 32Bit number (tag).

[4] Namespaces and Context Switching for Mecrisp-Stellaris, VD 1/2020

Mecrisp-Quintus 0.36

Mecrisp-Quintus (C) Matthias Koch is a rewrite of Mecrisp-Stellaris with almost the same look-and-feel for the RISC-V architecture. That's also true for the VIS-Extension. From a user perspective there is no difference between the VIS-Extension for Mecrisp-Quintus and Mecrisp-Stellaris.

The source code file vis-0.8.4.2-mecrisp-quintus.fs can be downloaded with vis-mecrisp-quintus.tar.gz (220814)

You can find a VIS Glossary (for Mecrisp-Stellaris) in the Forth-Magazin Vierte Dimension 1/2020 and some VIS (Mini) HOWTOs in VD 1/2020 ff.

projects/forth-namespaces/start.1660505800.txt.gz · Zuletzt geändert: 2022-08-14 21:36 von mm