This project has moved. For the latest updates, please go here.
Words in SharpForth are stored as DictionaryEntries in a Dictionary List.

Each word can either contain a C# delegate implementing the Forth Word or a list of Int32's that contain the addresses of other Dictionary entries (see pointers).

There is no difference between (FIND), >CFA and >DFA as they both point to the start of the word definition (basically an address with a zero low word). >CFA and >DFA are off-course not valid for words implemented with a C# delegate.

Each word (DictionaryEntry) has an Invoke() method that takes care of either calling the C# delegate or executing the addresses found in the Definition List. Executing the Definition List is performed by a private method called Execute().

Some words (like LIT, (0)BRANCH and EXIT) are defined with an empty delegate and are implemented in the Execute() method instead due to interaction of the word with the execution flow within the Defintion List.

Words are defined either in the Words class as static methods with attributes to define syntax and dependencies on other words or as plain static strings containing Forth in the Library class.

The Library class mostly contains code from the JonesForth.f file, where the Words class contains core words that cannot be implemented in Forth itself or words from JonesForth.f that would not work otherwise.

Words are located in the source code by either using Forth.Locate(word) or Forth.LocateI(word). The difference is that Forth.Locate() returns an address (pointer) and Forth.LocateI() returns an Index into the Dictinary List.

Last edited Aug 20, 2013 at 10:50 AM by wvd_vegt, version 7

Comments

No comments yet.