It is like 90% complete, and like works REALLY well
Lexer
I updated this a little bit. I changed how the functions are called so instead of doing execute the interpreter calls __str__ on it and it will return the python function to do that operation inside of eval.
As well I updated the parsing so you can put as many spaces or as little between operations as you want and it will still read just fine. like before you could only do ( A * 3 ) / 5 but now things like (A*3)/ 5 work just fine!
I also made strings get read in entirely
Also print statements now can use semicolons to seperate parts of a message on 1 line. like you can do
10 PRINT "A = "; A; " B = ";B
and it will print out “A = {A} B = {B}” with {A} and {B} being replaced with their actual runtime values!
Interpreter
I added some error catching and the global DATA array so the DATA statement can put its data in there
It now catches when you try to NEXT from a for loop that doesnt exist
also it catches when you try to RETURN from a subroutine when you never called a subroutine, as well as making sure that setting the program counter, via things like IF/THEN and GOTO are an actual line defined in the program
Up Next
I want to finish making sure all the functions and statements work as intended, as well as implementing DEF and DIM
I also REALLY want to get more details error reports, by also giving the line number where an error occurred, possible typo/solutions, etc
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.