Fronds source format
Fronds stores it's source internally, and currently doesn't have any export or import mechanism.
When Jason Woofenden generates the initial Fronds image in herkforth the Fronds source is generated along with the image.
Object Format
Objects are cell-aligned. They consist of a count cell followed by that many bytes of data, and however much padding necessary to be cell-aligned again (these padding bytes need not be preserved when the object is moved, but must be reserved for the object, because an object can expand into those bytes without being moved.) Pointers to objects point to the beginning of the data not the count.
Dictionary Format
The dictionary is several large arrays, one array for each dictionary field. These arrays store things like the CFAs, the word names, flags, etc.. All these arrays use the same indexes and have accessing words with the same naming scheme. In the stack diagrams and word names such an index is referred to as "dict". Example words: dict->cfa token->dict dict-cfa!
The dictionary is made of the following arrays:
- cfa (CFA or constant value)
- cfa2 (immediate's runtime version or variable value)
- comment (string object... stack comment and notes. one line)
- name (string object... name of word)
- flags (the compiler-relevant parts of type in a convenient format)
- compiled (bit field: compiled, runtime-version of immediate compiled, and some fields used in the bootstrapper)
- type (data, constant, word, etc. see fronds word types)
- def (definition)
Definition format
A definition is a object. The data of an object is an array of 16-bit source tokens. The high 13 bits are the index into the dictionary, and the low 3 bits are the "color". The color specifies what the compiler does with that word...
Source Colors
Note: it is convenient to refer to it as color, since most of us can easily distinguish them that way, but really the "color" bits specify what sort of actions are taken with that source token. The following colors are defined:
- 0: execute (yellow)
- 1: compile (green)
- 2: postpone (green with
,
prefix) - 3: define (red)
- 4: tic (yellow with
'
prefix) - 5: reserved (probably will become green version of tic)
- 6: natic (yellow with
`
prefix) This is exactly like tic, except it doesn't cause this word to get compiled - 7: reserved (probably will be used for comments)
Image Format
Here's the stuff stored in low memory, the left column is the memory address:
- 0: (entry point) branch to "run" word
- 4: 8 vm-init sets this... no idea why
- 8: dict-count (number of dictionary entries used) currently maximum is hardcoded at 1500
- 12: here (pointer to end of heap)
- 16: pointer to cfa2s (dictionary field)
- 20: pointer to comp?s (dictionary field)
- 24: pointer to cflagss (dictionary field)
- 28: pointer to types (dictionary field)
- 32: pointer to defs (dictionary field)
- 36: pointer to comments (dictionary field)
- 40: pointer to names (dictionary field)
- 44: pointer to cfas (dictionary field)
- 48: this points to the end of the dictionary (unused) currently dict-end is calculated off of cfas pointer above.