Each data is represented as unsigned integer. 0-255 as such Byte, 256 as I, 257 as K, 258 as KI, 259 as read, 260 as next, 261 as out, n>=262 if n is even as N-th code, else n is odd as N-th previous item on data stack.
n>=262 where
- n%3 == 0 as code
- n%3 == 1 as global Data item
- otherwise as local Data item
Every abstraction goes to Code area:
Each local function is encoded to the following sequence:
- Number of applications
- Number of arguments
- Each application
Every application goes to either Global Code or into Abstraction body. Represented as a pair of Data
Program wWWwwww
$local_data = [
256, 259,
256, 119,
256, 260,
256, 261,
];
$global_data = undef;
@code = (
1, 1,
(260+(2-1)*2+0), (260+(4-1)*2+0),
);
$current_source = [
256, (260+0+1), # wWWwwwwv on @code[0..]
];
# Step 1
push @$local_data, $current_source->[0..2];
# Step 2
!defined($currrent_source->[2]);
# Step 3
## Resolve $local_data->[-2..]Consider you have a function to take 2 items and call with f00 a00 a01,
and it returns f05a a00 a01 a02 a03 a04 a05 a06 a07 when the function wants
two more arguments to get evaluated:
it is a problem where to store such thing.
One idea is to make other memory: say @allocated, and
you have Data (~0), (~1), (~2), ... to indicate @allocated index.