Overview of wfroth

This chapter presents an overview of this language.

 Last update:

21-March-1999

State (estimation)

65%


This chapter includes the following sections:


What is wfroth?

wfroth is a "forth like" language and environment. My goal is to have a personal tool to develop an interactive forth cross-compiler for DSP and some others CPUs. The "forth like" kernel is written in the "C" language (not C++), so C is considered above all as a portable run-time library. Performance and speed are not the issue because we do not really care for the host environment. My first forth cross-compiler will be for the Texas-Instrument TMS320C50 DSP. In the past, I have written a forth cross-compiler for the ADSP-2181 (using the FPC forth as HOST language), and maybe one day I'll create a version running under wfroth. wfroth is running either under Windows/NT or QNX/Photon (you just have to recompile the source). wfroth is then running in its own text terminal window (say 25x80 in standard).
 

Wfroth is designed above all to create forth cross-compilers for DSP or other CPUs. 
It is NOT designed to create stand-alone programs running on the PC (either under Windows/NT or QNX/Photon). 

Documentation

I try to write an associated documentation at the same time I add new functionnalities to wfroth. I understand that a language without his documentation is not really usable by others people than me. And also, althought wfroth share many things with the Forth language, it does not follow the Forth ANS standard. I really think Forth is more a concept than a rigid language.

Why I spent time on this personal project?

Because I love Forth! Why Forth in 1999, when we have NT, QNX, Visual Studio, Java, DSP sophisticated development tools, etc? The answer is: simplicity. Both the operating systems, even embedded, and the associated tools, become more and more complex. That means that often you spend a lot of time time on understanding the operating system or the derivated tools (compiler, debugger, emulator, ...). More complex is a system, more chance there is to have bugs. Because Forth is simple and lean, you don't spent many time to understand how it works. You have little chance that your program does not work properly because there is a bug into the OS or the compiler, or the debugger...

What is the current state?

Well, its the beginning of this project, so there is still plenty of work to do. Or course, I do this project on my spare time. You know what that means...
 

Part

Last update

Current state 
(estimation)

Forth kernel (C + Forth definitions)

7-Feb-1999

65%

Documentation

7-Feb-1999

20%

TMS320C50 cross-compiler + kernel

7-Feb-1999

45%

What are the differences with the Forth language

Here is a non exhaustive list of some main differences with the Forth language:

o        wfroth always compile: either a named definition, or an anonymous definition. That mans that you have to use ; (semicolon) to run an anonymous definition (called 'immediate mode' in forth). This choice has been made to simplify the interaction with the target system.

o        wfroth use the concept of "address register". That means that for example executing a variable do not push the address on the stack, instead set the address register. This choice has been made because of the internal architecture of the DSP.

Snapshot

Compiling to create wfroth executable

The archives contain executables for both Windows and QNX/Photon. It's a good idea to recompile them. Some #ifdef are used to handle 3 different versions:

o        _QNXPHOTON : wfroth run in a window under the QNX/Photon environment. The text window is managed by wfroth, it's not a wterm application.

o        _WINDOWS : wfroth run in a window under Windows 95/98/NT. The text window is managed by wfroth, it's not a console application.

o        _CONSOLE : wfroth run in a console window, a facility provided by Windows. This allows to copy/paste, or to run in full screen text mode, in 25/43/50 lines.

Under QNX/Photon, a makefile is provided. Under Windows, a Visual C++ v5 workspace is provided, with 2 projects: one for the _WINDOWS mode, one for the _CONSOLE mode.

First contact

Run the executable wfroth, then try typing the next things:

10 ;
. ;
10 100 + . ;
-50 200 - . ;
-50 200 swap - . ;
: add10 10 + ;
words
900 add10 . ;
what add10
see add10
: cr 10 emit 13 emit ;
: hello cr " Hello world!" type cr ;
hello ;