RodrigoDornelles / 3bc-lang

Low-level language, tiny virtual machine, minimal runtime, intermediate representation, embeddable, easy for beginners. (Friendly Punched cards)
https://3bc-lang.org
GNU General Public License v3.0
231 stars 25 forks source link

create literal for label #408

Open RodrigoDornelles opened 1 year ago

RodrigoDornelles commented 1 year ago

considering that the virtual machine was separated from the interpreter itself and the djb2 hash literal :like_this will be maintained, the behavior of cpu modes 9 and 42 was also changed to absolute address. this is a new idea to facilitate jumps.

read

MODE NILL 0d2
STRC NILL 'A'
STRC NILL 'M'
STRC NILL 'O'
$LABEL
STRX NILL 0xCA
STRX NILL 0xFE
MODE NILL 0d9
GOTO NILL $LABEL

result

MODE NILL 0d2
STRC NILL 'A'
STRC NILL 'M'
STRC NILL 'O'
MODE NILL 0d4 #5
STRX NILL 0xCA
STRX NILL 0xFE
MODE NILL 0d9
GOTO NILL 5
RodrigoDornelles commented 1 year ago
MODE NILL 0d2
STRC NILL 'A'
STRC NILL 'M'
STRC NILL 'O'
LABEL:
STRX NILL 0xCA
STRX NILL 0xFE
MODE NILL 0d9
GOTO NILL $LABEL