Hey folks! Last weeks I've been picking up programming again, and I decided to create something like ICE, but better Smile

I'm proud to present to you: IndiumCE, a fast BASIC interpreter written in C++. I started it in C, but then I wanted to try C++, and it's super nice to use. Currently the bone structure exists for parsing the program, and I started writing code for evaluating the program. So far only "Disp" is implemented, as well as a few unary operators. Still lots to do, but development goes fast! Also, at the beginning it copies all OS variables to IndiumCE, which means you can use external inputs as well!

Anyway, let me present to you: first the default BASIC execution, and then my super speedy interpreter:



Code can be found at my GitHub, don't shoot me Razz. Contributions are always welcome, issues less Wink.

Things I want to focus on now: implement all the operators, then functions, then commands. Not sure how fast I will go, as my study takes quite some time as well, but meh.
A very good initiative and something that people have been asking for on and off for a while!

Do you plan on having all programs 'console' like? Or will you be looking at graphics and such too?

It would be cool to see when you can replace your demo program in the screenshot with a loop & variables Smile.
That looks awesome! I'm really happy that there is now a really good interpreter for BASIC, and also to practice my C++ skills. When I have a lot more time, I'll probably go over to the GitHub and help/just look at the code and be amazed.
This is a very great project and great start. I am curious what will be the speed difference for future commands but I'm optimistic they will be significantly faster. Smile

Will order of operations be the same as in regular TI-BASIC?
tr1p1ea wrote:
Do you plan on having all programs 'console' like? Or will you be looking at graphics and such too?

For sure! I plan to have a full graphics screen, just like the real BASIC.

DJ Omnimaga wrote:
Will order of operations be the same as in regular TI-BASIC?

Definitely! I want to be as close to TI-BASIC as possible (except the weird quirks...), which means the same order, implied multiplication etc.
Will there be compatibility for the entire screen, like ICE, or will it be as close as humanly possible to the real BASIC? Will you be removing some of the limits, such as e+100/e-100 limits or 999-element lists? Will you be adding extra colors/RGB? What is the scale of this project?
My thoughts: make this kind of like an invisible shell; running Indium would essentially (from the users point of view) do nothing -- but suddenly, TI-BASIC is much, much faster.

On the back end, it replaces (probably going to be a lot of goofing around with eZ80, but ah, well -- it was inevitable) the TI-OS interpreter with its own. Running the program again switches it back. In other words, running the program installs/uninstalls hooks that effectively improve TI-BASIC's speed.

If that makes sense...

(not actually an) EDIT:
Just had another thought. I've been toying with the idea of a sort of KnightOS for the CE -- maybe PrinceOS? -- that is essentially TI-OS but significantly improved. For instance, Apps would no longer need to be signed, it would have an 83-series screen "emulator" (essentially mateo's mono2color project on the CSE way back when) that can run BASIC meant for monochrome calcs -- and display it properly. It would still have a decent test mode (because, you know, the SAT exists), and would have all the features of various TI-OS iterations that the CE doesn't have. For instance 3D graphing (albeit slow 3D graphing). The point being: it would be kind of interesting to use this as the default TI-BASIC interpreter for this (as yet unstarted) project. What would you say to that?

actual edit this time:
Will this have better error handling than regular TI-BASIC? That is, will it direct you to exactly where the code goofed up, and/or give you a bit more details about what went wrong?

pls say yes pls say yes pls say yes
S/jr/W wrote:
Will there be compatibility for the entire screen, like ICE, or will it be as close as humanly possible to the real BASIC? Will you be removing some of the limits, such as e+100/e-100 limits or 999-element lists? Will you be adding extra colors/RGB? What is the scale of this project?

This program will match BASIC as close as possible. So you won't have extra commands to do fancy file I/O, use full screen etc. Its target is to run any BASIC program and behave the same.

darkwater4213 wrote:
My thoughts: make this kind of like an invisible shell; running Indium would essentially (from the users point of view) do nothing -- but suddenly, TI-BASIC is much, much faster.

On the back end, it replaces (probably going to be a lot of goofing around with eZ80, but ah, well -- it was inevitable) the TI-OS interpreter with its own. Running the program again switches it back. In other words, running the program installs/uninstalls hooks that effectively improve TI-BASIC's speed.

If that makes sense...

Good question, and it has been asked earlier in IRC. I'm not planning to make a hook and fully automatically run my program instead of letting the OS do it. At least not in the near future. Turning a C program into an app (AoCE) was already hard enough, let alone using hooks and whatever.

darkwater4213 wrote:
Will this have better error handling than regular TI-BASIC? That is, will it direct you to exactly where the code goofed up, and/or give you a bit more details about what went wrong?

pls say yes pls say yes pls say yes

Currently it throws errors during compiling, in which case it shows the line number and column. When a runtime error is thrown, it also shows it, but it's wrong (it shows the last line + 1, and column 1). Might need to fix that Razz

Also, updates: thanks to commandz (and a little help from others) I replaced my entire operator part, and made it more C++ style. Now it's super easy to add new operators. Every unary operator is implemented, while I still need to think about a framework for binary operators, but that will happen soon Smile
PT_ wrote:
Good question, and it has been asked earlier in IRC. I'm not planning to make a hook and fully automatically run my program instead of letting the OS do it. At least not in the near future. Turning a C program into an app (AoCE) was already hard enough, let alone using hooks and whatever.

Have you considered using capnhook? I'm not going to claim that it makes it easy, per se, but at the very least it doesn't require that you make it an app, and handles a lot of the annoyances that hooks generally involve.
I'm somewhat interested in potential overlap between this and scope for BASIC support in tihle, since I've previously considered implementing an interpreter along these lines but haven't done so.

It seem like taking advantage of this in tihle would be difficult, since even if the CE-specific bits were hidden behind a swappable API surface it would be relatively difficult to integrate your C++ with my Rust (and similarly if I implemented something in Rust it would be difficult to build for the CE)- but perhaps if it had a C API?

And because I fell down a parser hole thinking about this, I notice you're parsing numeric literals the naive way (accumulating digits in the output type) which is likely very prone to accumulating error. I don't have any real intuition on it, but suspect numeric literals will diverge from their intended values surprisingly quickly when they have fractional components.
~bump~

Congratulations for being featured in Project of the Month March 2022! I can't wait to get IndiumCE on my calculator!
Compiling it seems to not be working, are you still developing this?
  
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