Work on high level language underway


After about a month long hiatus, progress on Pemu 2 has once again started. 

Planned new feature:

The new feature will be a new programming language called Peak 2. Peak is a lightweight (but still modern) C-like language. Peak will compile down to Plow which will compile down to a Pemu binary. There is no implementation but a small example of a typical Peak program will look like this:

let Integer x = 5;
let Ptr pX = &x;
print("x: ");
printf(x);
print("address of x: ");
printf(pX)
OUTPUT (not code):
x: 5
address of x: 6

which would compile to about this equivalent Plow program:

# setting up argcache
expram 4
# setting up varcache
expram 2
# loading 5 into mem, ptr in argcache slot 0
expram 1
mov 5 > [rpr]
mov rpr > [0]
# moving argcache ptr to varcache slot, essentially moving the pointer from temporary storage to personal permanent slot
mov [0] > [4]
# i gave up on the ptr stuff its too complicated for how tired I am to predict how my compiler would
# act in this scenario. I know it would be in slot 6 though
prs "x: \0"
# ptr to x in gpr0
mov [4] > gpr0
# deref ptr to x to get x, val of x in gpr1
mov [gpr0] > gpr1
pri gpr1
prc "\n"
prs "address of x: \0"
pri [6]
prc "\n"

Release date:

Still too early to say, but because of how big of a project this next feature is it will likely be at least late April-late May before it is done. In the meantime I might release patches if I find any bugs, but I haven't found any yet (that I remember).

Files

Pemu 2.zip 7.1 MB
Mar 09, 2024

Get Pemu 2, a computer sim

Leave a comment

Log in with itch.io to leave a comment.