Would you use TIB.js if it were available?
Yes
 66%  [ 2 ]
Uncertain
 33%  [ 1 ]
No
 0%  [ 0 ]
Total Votes : 3

Hello,

This is my first post, so it's a very ambitious idea. As in the title, it's a JavaScript API I have called TIB.js in which you write JavaScript code using the API and TI-BASIC source code is generated. It also emulates the behavior of what TI-BASIC would be generated as if it were run directly on the calculator.

Important: This is for TI-BASIC on the TI-83/TI-84+/TI-84+ CE models

Example:

Code:
const prog = new TIB("MYPROG");

prog.sto(prog.add(5, prog.complex(6)), 'A');
prog.disp('A', true);
// 'true' tells TIB.js to treat 'A' like a variable and not pure text

prog.export();


You create a new program by calling the constructor, TIB(). It does throw an error if you provide more than 8 characters, since that is the character limit for program names. The math expression system is very modular to allow using math expressions to generate other ones for use in other sections of the code, like if you want to use a math expression at the start and end of your program if, say, it was a really big program.

complex() is how you create the objects TIB.js uses to represent complex numbers. export() simply generates the TI-BASIC source code.

The result of that example would be:

Code:
5+6i->A
Disp A


You can get really modular with

Code:
const prog = new TIB("MYPROG");

let real = prog.add(5,6);
let imag = prog.complex(6);
let expr = real.divide(imag); // prog.divide(real, imag); works the exactly the same

prog.sto(expr, 'A');

prog.export();


As of right now, I have finished the math-parsing system, and am currently working on the different commands in TI-BASIC.
Interesting idea; this feels similar to tools like Amaranth HDL where you're wrapping your target language in syntax that's arguably more cumbersome to write, but it becomes much easier to modularize your work as well so it's still easier to write the wrapper language. I'm not sure I see much value in doing that for TI-BASIC though, since the syntax and semantics are so tightly coupled?

I'm also somewhat curious about the choice to support executing code directly in this system, rather than simply executing TI-BASIC code. I can see that it would probably be easier to implement in terms of your language frontend than in terms of BASIC's own syntax, but it also seems quite limiting in that a truly accurate TI-BASIC interpreter is a very large amount of work to implement and one that consumes only your wrapper dialect would have very limited utility. I suppose you could always implement a translation from BASIC code back into your API before execution, but then you still need to solve the issues of BASIC syntax.


Have you seen TI-JS? That's the only real published project I'm aware of that attempts to build an 8x BASIC interpreter, but I believe there are at least two others out there (one of them my own) which aren't in a state that their authors have really 'published' them yet. That is to say, there are probably at least a few people who might have suggestions for implementing a BASIC interpreter.
  
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