Implementation of lox language (see this awesome book to learn more about it) in PICO-8.
Try typing basic commands like:
rectfill(32, 32, 58, 58, 9) print("hello", 10, 10, 8) |
For more syntax reffer to this page. I dont think I've implemented OOP, tho.
Runs a basic AST-walker, so it might be slow, but I got some simple PICO-8 carts running, like this one:
(see the source code)
This is cool! A problem I noticed is that when in splore escape won't pause. This can be fixed by changing your _update() function to
function _update() t+=1 if stat(30) then t=0 local c=stat(31) if c=="\b" then if(#input>0) input=sub(input,1,#input-1) elseif c=="\r" then poke(0x5f30, 1) local x,y=cget() rectfill(0,y-1,#input*4+16,y+5,0) print(": "..input,x,y,6) local i=input input="" print("") color(7) ext(i) else if (c=="p") poke(0x5f30, 1) input=input..c end end end |
So that the pause suppression only happens when you press enter or p.
EDIT: you might also want to prevent people from typing double wide characters, they don't get erased properly.
[Please log in to post a comment]