Memory is organized as follows:
0000 0100 @heap @heap-ptr @syms-ptr fc00 ffff
| | | ^ ^ @syms|@input |
v ZPpt v v | | v input-ptr v
+--^---+----------+-------------*---------------*--------------+-------^-------+
| <ZP> | <kernel> | <user code> | <free memory> | <syms table> | <input buff> |
+--*---+----------+-------------*---------------*--------------+-------*-------+
|==> |##########|=============> <==============|=======>
(256B) ( growth direction ) (1Kb)
Merlin CLI REPL
█▄ Version 0.8 (06/06/2024).
▐ █ ▌ Concatenated Interpretive Uxntal JIT Assembler.
▀█ ©MMXXIV Ismael Venegas Castelló, MIT License.
57865 bytes free (bytecode: 0, symbols: 1331 bytes used).
փ > #2a18 DEO
*
WST 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|<
RST 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|<
փ > @star #2a18 DEO JMP2r
WST 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|<
RST 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|<
փ > star
*
WST 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|<
RST 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|<
փ >
A parent label starts assembly mode, this will do the following:
- Assemble the input buffer and place the code after the current position
of
@here
, and update the@here
pointer. - Add an entry to the "dictionary" ("header" format still under design) and update it's pointer.
Note: [
and ]
allow multiline input.
փ > @star ( -- ) [
... [ LIT2 "* -Console/write ] DEO
... JMP2r
... ]
WST 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|<
RST 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|<
փ > star
*
WST 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|<
RST 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|<
փ >
Doubts:
star
JSI semantics (but not syntax) will need to be adapted to jump to an absolute address in REPL mode?- How to allow multiline input without using
[ ]
?
The assembled code area will be concatenated as if assembling Uxntal normally.
| @here ( 1337 )
| a0 2a 18 17 6c ( #2a18 DEO JMP2r )
|
∨ @here ( 133c )
The dictionary will grow in the contrary direction at a constant size for each
entry. Instead of a linked list in tipycal Threaded Interpretive Languages
(TILs), concatenating in inverse order to an array. When searching for a routine
searching from last entry to first as done by TILs is accomplished by
starting the search from the "physical beginning" of the array, where the
current @dict
pointer points to.
∧ @dict ( ????-n entry bytes )
|
| identifier addr
| s t a r ( pad to n max bytes ) 1337
| 73 74 61 72 00 00 00 00 00 00 00 00 13 37
| @dict ( ???? )
| ( primitives )
Concatenating instead of threading the routines allows for the usage of Uxntal and not another Uxntal like language with new or different syntax though some semantics may need to be adapted.
փ > [
... @<pdec> ( dec* -- )
... DUP #64 DIV <pnum>/try
... DUP #0a DIV <pnum>/try
... ( >> )
...
... @<pnum> ( num* -- )
... #0a MOD [ LIT "0 ] ADD .Console/write DEO
... JMP2r
...
... &try ( num* -- )
... DUP ?<pnum>
... POP JMP2r
... ]
WST 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|<
RST 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|<
փ > #002a <pdec>
42
WST 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|<
RST 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|<
փ >
In this case calling <pdec>
would fall through to <pnum>
body as in normal
Uxntal, something that would not be possible with a tipical threaded
implementation.
- Drifblim uses Console and File, drifloon only Console.
- loon uses
@token $2
while blim uses@token $1 buf $30
.
- loon uses
<assemble>
and<read>
. - blim uses only
<assemble>
on files.
- Return to repl when when evaluating break
BRK
expression, by pressing Enter 3 times. -
#foo!
should be a Number error (fixed in drifblim). - Reset symbols and heap after expression evaluation, just like done with the heap.
- Clear heap and symbols after error.
- Reset PC after absolute padding expression?
- Fix lambdas, not being binary compatible with uxnasm.
- Reinstate include rune.
- Make multiline more robust.
- Use walkcomment and allow nesting.
- Make
<pmem>
take the lenght to dump. - Make rom smaller (no unused space in between code/data).
- Make symbols store code length
- Implement macros.
- Implement library path.
- Make debugging toggleable.
-
[]
,{}
,()
parse these correctly. - Comment out debugging for release.
- Refactor into something better the file hierarchy.
- Remove uneeded experiments.