compiler-constructionti-basic

Text to TI-BASIC Compiling


So as a Year 10 Centre For Excellence student, we are required to buy ourselves a TI-84+ calculator. This is a Calculator by Texas Instruments. The company has created a high-level programming language by the name of TI-BASIC (after a quick google it is derived from the original language BASIC.) Now, I have been sifting through the internet, but I think I am only reaching the surface. I feel like I haven't even hit clay that's how vague I think I am on this topic. On that note, I'm sorry if my language isn't correct. :/

I have managed to come across many many compilers that compile a plain text document (.txt) right into a TI 8 Series Program document (.8Xp). So my questions are:

Things seem to massively confuse me at this point. The topic has only reached the surface of my mind.


Solution

  • If you are truly trying to create a TI-BASIC "compiler" for the computer, you need to see what tokens everything has. TI-BASIC works on the idea that things like If, Disp are all actually 1 or 2 byte tokens that get parsed by the calculator when it is run, parsed meaning they each execute a series of instructions in real time which is a relatively slow process (like scripting). Heres the Token List. So really its just a matter of converting everything to their respective tokens. Past that I really have no idea how the .8xp file structure is formatted, and you would have to google that (plenty of people have done it, calculator forms like Omnimaga can help you there).

    If you just want one on the computer to work with rather than making one, you can use TokenIDE which in my opinion is one of the best, but there are others.

    Also, as the comments said the calculators base language is actually Z80 assembly (makes sense as the cpu is a Z80), and there are a few languages that actually go from calculator tokens into compiled assembly sort of like C++, the most popular and amazingly designed one being Axe Parser. This is helpful if you want to work with more low-level features of the calculator without actually learning assembly fully, but it does require you to learn the Axe language which can be tricky if you are not familiar with how pointers and how data is stored in the memory. Real assembly can be transferred directly to the calculator as .8xp but with a different format so it knows the data is actually opcodes rather than tokens, and will allow you to run it with the Asm( command.

    Hope that helps.