FooProg

From Esolang
Jump to navigation Jump to search

FooProg is a high-level, bytecode-compiled esolang invented by User:None1 in 2023. Like its name, its author doesn't consider it important.

In 2023, the compiler, disassembler and IDE written in Python (3.10+) and the bytecode interpreter written in Python and C++ are coded. But the author thought it was a rubbish and decided not to develop it more or put them into the public.

In 2025, the author became interested in it again and decided to develop it more. The compiler, IDE and interpreter are not put into the public yet for the author is busy (and Internet problems).

Features

  • Variables, wrapped with $'s, are integers or doubles.
  • The only control flow is do-while loop.

Bytecode

Currently, FooProg's bytecode has only 9 commands: 0 add 1 sub 2 mul 3 div 4 set 5 copy 6 read 7 write 8 jif.

VM

FooProg VM consists of only one thing: A memory that uses 64-bits addresses, implemented using a dictionary.

Example programs

Fibonacci

$a$=0;
$b$=1;
read $c$;
do{
        write $a$;
        $d$=$a$+$b$;
        $a$=$b$;
        $b$=$d$;
        $c$=$c$-1;
}
while $c$;

Disassembled bytecode:

00000    set 1,0:uint    04 01 00 00 00 00 00 00 00 01 30
0000c    copy 0,1        05 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00
0001d    set 3,1:uint    04 03 00 00 00 00 00 00 00 01 31
00029    copy 2,3        05 02 00 00 00 00 00 00 00 03 00 00 00 00 00 00
0003a    read 4          06 04 00 00 00 00 00 00
00043    write 0         07 00 00 00 00 00 00 00
0004c    add 0,2 -> 6    00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 06 00 00 00 00 00 00
00065    copy 5,6        05 05 00 00 00 00 00 00 00 06 00 00 00 00 00 00
00076    copy 0,2        05 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00
00087    copy 2,5        05 02 00 00 00 00 00 00 00 05 00 00 00 00 00 00
00098    set 7,1:uint    04 07 00 00 00 00 00 00 00 01 31
000a4    sub 4,7 -> 8    01 04 00 00 00 00 00 00 00 07 00 00 00 00 00 00 00 08 00 00 00 00 00 00
000bd    copy 4,8        05 04 00 00 00 00 00 00 00 08 00 00 00 00 00 00
000ce    jif 4 -> 67     08 04 00 00 00 00 00 00 00 43 00 00 00 00 00 00