I was messing around with ti-basic on my trusty 84 and made a neat program of sorts. It is written in complete basic and while it doesn't accept "lua programs" and is just single line input, I feel it is a fun little program. It weighs 1500 bytes and includes:
print(
-printing variables and strings
io.read()
-currently just asks for input
Custom Variables!
-stores custom variables
-ex: Var=1234; var now equals 1234 and can be paired with the print(
A CAS of sorts?
-User equations will be answered
-ex: 500+500 returns 1000
-ex: 500>200 returns "True"

So while it isn't really Lua it sort of is.. Here is a screen vid:
oh and you will notice that when inputting math equations then it needs to follow with a ":" I'll probably take it out though. As well as the print function uses ',' instead of ".

Any comments and suggestions are welcome!
Looks like a fun exercise in writing a parser, zeldaking! Do you have any plans to continue and expand it, or is it mostly a fun project for now? Also, did you know that [2nd][alpha][alpha] enables lowercase Alpha-lock? Smile
Thanks! Oh I didn't know about the alpha lock, that would help a bunchi with using the emu. Also it was a fun project for now, but I added other things to it. I'm just stumped on implementing; for and repeat until loops. As well as if then statements. I have an idea that would cut down my code and probably speed as well but I haven't got around to it. And it is a bit slow since it is dealing with strings constantly. But for now it is a fun start.
I would think for loops, you'd need lists to track the variable for each loop, the current value, and the bounds or condition for the termination of the loop (or a pointer to the location in the string of code where the loop condition lies). Since you can have arbitrarily nested loops, you'd need lists of each thing, I'd say.
Yeah that's a good idea! And for my custom variables I have each variable name in a string and when called it looks it up in the string with instring and with each variable I have a number before, signifying what number it is. So for example: "1string2var3new4VAR" etc. after searching for the variable it returns the number in front of the variable which is now plugged into a list which has the corresponding value. I am pretty happy on how I came up with it. So for the loops I will have to check the Boolean like I did in my Math input that returns "true" and "false", and check for that with the correct loop type. Mainly for the if and repeat until loops. The for loop will probably set up a little different. But as of now I have no need for them as it is just single line "parsing" if you will. I might move into Asm since I have always wanted to get into z80 but never have any ideas that would be plausible in it.
I also added a few new things today:
-io.read() can be paired with a variable name so the direct input is what the variable will equal.
-math.randomseed() takes a random number 0 to 1 or 0 to whatever is included in the parentheses
-screen.clear() I thinks that's what it was called, it clears the screen.
-fixed up a bug of some sort in my math routine
-optimized my string to number routine which is used heavily
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement