Dictionary Structure

We have chosen to implement a simple dictionary structure for RetroForth. Basically there are two linked lists; one for each dictionary. Each entry looks like this (in assembly):

dd link_to_previous_entry
dd address_of_word
db length_of_the_name
db 'the_name_itself'

The first entry in the dictionary has a link to the address 0 in the first field. This is used to signify the end of the dictionary. We provide a meta-variable named last which provides a pointer to the most recent entry.

What if you want to get at the first entry? Define a word that walks back through the dictionary and returns the address of the first entry. Something like this can work:

: first last repeat dup @ 0; nip again ;