| Home Introduction Using Holon Holon Tools Contact
HolonJForth |
Forth
The Forth words are defined in the toolbox as a preamble to the target program. Standard Forth wordsMost words are implemented as code words (actually macros), which insert Java byte code in line. Examples:
A couple of words are implemented as methods of external classes in the Java library. Example:
OperatorsThis preliminary set can be expanded as needed. The operators are defined in the toolbox in the target. Arithmetic
Logic and binary
Comparison
Assignment
Flow control structuresThe flow control words are implemented with the compiling word constructor of Holon. Example:
LiteralsNumbers are compiled according to their size as either 8 bit bytes, 16 or 32 bit integer values. Forth double numbers (numbers with a dot) are compiled as 64 bit long values. Return stackHolonJ implements a return stack for local storage in a method. The return stack is not needed for the execution of Forth words (methods), because execution is taken care of by the JVM. We use the return stack to implement do..loops and for intermediate storage. The push operator depends on the type of the data value. i>r pushes an int, a>r pushes an object reference. r@ and r> recall the top value on the return stack, taking care of the type as well.
|
|
| © 1999-2005 Wolf Wejgaard |