ticalc.org
Basics Archives Community Services Programming
Hardware Help About Search Your Account
   Home :: Community :: Articles :: Is it Time to Replace TI-BASIC?
Is it Time to Replace TI-BASIC?

Posted on 21 February 2005

The following text was written by George Limpert:

Anyone who remembers coding in TI-BASIC on the TI-81 or TI-85 and has then has coded for a more modern calculator knows the language has made great strides. Many of these changes have been influenced by the collection of nerds and gamers we affectionately refer to as the TI community. When TI created their original graphing calculator models, they never envisioned they would be used for the purposes we have found for them. A large portion of the changes to the language reflect the ideas of students over a decade ago who envisioned their calculators entertaining them during boring lectures. Despite the many changes to TI-BASIC, the language is still looked upon by the best game programmers as inadequate at best.

The complaint of many programmers about TI-BASIC is its speed, or the lack thereof. Unfortunately this issue is unlikely to be addressed anytime soon. When TI designed the language, they envisioned a way of adding new math functionality to the calculator, but with safeguards in place to prevent harmful behavior by programs. Speed of program execution is nice but doesn't appear to have been one of TI's primary objectives when creating the language.

Some people will suggest any serious programming ought to be done in assembly language. Compared with programming in TI-BASIC, it's like going hunting with a rifle instead of a pocket knife; it's faster, more powerful, and there's nothing to stop you from aiming that rifle squarely at your foot. If you make an error programming in TI-BASIC, you get an error message awaiting you to press a key. A mistake programming in assembly might give you a sudden boost of free RAM in exchange for your valued programs, equations, and notes. It's probably best to do serious game programming in assembly, but what about other types of programs?

Not too long ago, a fellow with a fine idea for calculator programming visited the flagship IRC channel for discussing TI calculators. Instead of compiling TI-BASIC programs so they run faster, he proposed replacing the language altogether. While he was met with ridicule, the idea is worthy of further discussion.

Last semester, I took a course on data compression techniques. One project assigned was to implement a Huffman encoder and decoder in C or Java. The discussion in class about Huffman coding went in one ear and out the other. Instead of struggling with C, I decided to implement the project first on my TI-89 because I expected TI-BASIC to be simpler. After about five minutes into coding, however, I hit a roadblock; there's no easy way to implement any sort of trees. Sure, it's possible, but to many programmers it's not obvious how to create or manipulate trees. The solution is to represent each node as a list; the first element is the value and the second and third elements are the names of child nodes within the binary tree. The child nodes are then accessed using a wonderful feature of the language known as indirection. On the TI-83 line of calculators, however, indirection isn't possible, and one would have to use a matrix, instead. Manipulating a matrix is slow and makes the programming involved even more complicated.

A tree is one of the fundamental techniques used in programming. It's applicable to many algorithms including searches and sorts. Unfortunately it can't easily be done within TI-BASIC.

This discussion also addresses another major limitation of TI-BASIC. What if, instead of storing the name of a child node, I want to store another data structure, such as a list, in one of those spots? The answer, of course, is it's not possible. One might ask why anyone would want to do this. Consider, for example, if a programming task involved pushing an integer and a list to a stack. While no such task readily comes to mind, it's a reasonable proposition. Stacks are another fundamental technique of programming. And, of course, complex data structures alone are useful at times.

There are many other such examples of why TI-BASIC is inadequate. Even if it will never be a fast language, simple programming techniques in the language ought to be exactly that -- simple. These limitations make TI-BASIC useless to many applications that are not at all related to gaming.

Programming in assembly can be difficult and dangerous to your data. It also usually requires a computer, a link cable, and a lot of patience. If that's not the best option and TI-BASIC is inadequate, maybe another programming language isn't so absurd of an idea after all.

The obvious question then becomes what features should such a language have. If a language is to truly replace TI-BASIC, it ought to have all the features that TI-BASIC currently has with some additions to fix the limitations with TI-BASIC. It's likely a replacement for TI-BASIC would need to be interpreted instead of compiled. One might assume that if we're creating a new interpreted language that has more features than TI-BASIC that it would be even slower. This is not necessarily the case.

The architecture of compilers and interpreters are very similar. The first step in either is referred to as a lexical scanner. This scans through the program text for keywords and symbols. The output generated is a series of tokens which represent the text of the original program. TI-BASIC does this as well; on some calculators, programs are always represented as tokens, but on others you will notice a delay when running a program for the first time due to this conversion. The next step of a compiler or interpreter is a parser. This deals with the syntax of the language, converting the string of tokens to a tree structure. A tree in an accurate representation of how a language is actually evaluated. Following this step is semantic analysis. A statement in a language may be syntactically correct but still make no sense to the compiler or interpreter. At this step, actions such as checking type and scope of variables are performed. At this point, compilers and interpreters diverge. An interpreter will evaluate the parse tree and execute the statements while a compiler will output another language such as assembly language or machine code.

This discussion on the architecture of interpreters is relevant because the implementation of TI-BASIC is not necessarily the most efficient scheme. Most likely, TI-BASIC stores programs merely as a stream of tokens because of the space required to store a representation of a parse tree. A parse tree, however, can be converted back to plain text just as the stream of tokens can. If parsing is only done once instead of being done constantly during execution, greater speed can be realized. One need not stop after parsing, however. Much of the semantic analysis step can also be performed at this time without modifying the parse tree. One may view this as a trade-off between program size and execution speed, but it need not be the case. A parse tree, when outputted to a file, can be compressed and then uncompressed at runtime, which may gain back some or all of the space lost to representing the program as a parse tree.

Another major change to such a new language is in the area of variables. There is no method within TI-BASIC to store a reference to another variable. Therefore any reference variables will necessarily be local to the interpreted program. Such a language, however, would still need to provide easy access to variables from TI-BASIC. This means that any variables that are to use the additional features of this language will need to be declared within the program. If this is the case, it allows for a few other enhancements to the language. One potential enhancement is the concept of aggregate data types.

Dealing with variables is a major slow point of TI-BASIC. The language on some calculators provides two very useful features for programmers -- dynamic types and dynamic resizing of variables. Dynamic types mean that if I have an variable currently storing an integer and I choose to store a string it it, the variable becomes a string variable. Dynamic resizing of variables means that the space used to store a variable is automatically expanded or contracted depending on how much space is needed to store the data. While these are very useful enhancements, they are also slow. A new language could make these features optional to programmers, providing an additional speed boost.

In spite of these and other possible enhancements, some tasks are better suited for assembly language. Furthermore, programmers shouldn't have to reinvent the wheel every time they write a program. PHP had a good idea when it allowed modules to be added to the interpreter that extend the functionality of the language. While a new calculator language may be at the core a replacement for TI-BASIC, the ability to extend the language through modules instead of writing a new interpreter makes the language far more powerful than it would be otherwise.

TI-BASIC is a fine language suitable for many tasks. Assembly has many advantages over TI-BASIC and has many uses as well. There are, however, many programming tasks that for one reason are another are not suited well to either language. A replacement for TI-BASIC, if sufficiently enhanced, can make TI calculators a far more powerful tool. The question of a new programming language shouldn't be a question of if but of how and what.

  Reply to this item

Re: Is it Time to Replace TI-BASIC?
rjrouquette Account Info

Why not just create a new OS for the calculators. I'm not talking about a shell or add-on. I'm talking about full out new ROM OS. A new OS could have new language and be faster. New functions could even be added. The only problem I see with my idea is that it would take an extremely long time to develop.

Reply to this comment    13 April 2005, 22:07 GMT


Re: Re: Is it Time to Replace TI-BASIC?
Joey Adams  Account Info

The main thing stopping me is my lack of technology to do just that. I can't even download pedroM because TiLP doesn't work because I have a USB cable.

The first step to doing this is to make sure that when the calculator reboots under the new operating system, it can safely be hooked up to the computer and safely be reverted back to the TI operating system (or another custom one). The biggest danger I see is the possibility of writing a messed up operating system that causes your calculator to become entirely unusable (If I'm not mistaken, that's possible).

Reply to this comment    3 June 2005, 03:54 GMT

Re: Is it Time to Replace TI-BASIC?
Andy Dang  Account Info
(Web Page)

Basic overall is not a program you would use for games obvuously. I wrote for my 85 then 86 so I know that if the trend continues basic will evolve and maybe into something better :/. The only real use of basic is for making math programs quickly, that remembers all of you formulas for you :).

(BASIC-86= Top Grades Geometry/Trig)

Reply to this comment    18 August 2005, 01:46 GMT

Re: Is it Time to Replace TI-BASIC?
StuffPosingAsMail  Account Info

TI-BASIC does not need to be replaced. Sure, it would be nice to have something on-board that would run faster, but the simplicity of the language is mainly what I think is so good about it. It is a language that you can truly experiment around with and learn programming with without doing any possible damage to your calculator. TI-BASIC was my first language (only 2 years ago) and now I've already learned Visual Basic, some C++, some NQC, HTML and JavaScript editing (nobody ever taught me and I only mess around with it occasionally for fun so I see no need to officially learn it), and my next stop is MASM. So, though TI-BASIC itself is limited, it leads to much larger stuff and sets a good foundation for beginning programmers.
The main thing I think TI should work on right now is the quality of their calculators hardware-wise. I am extremely disappointed with the TI-84 SE. My brother won one in a national math competition, so that is the only reason why anyone in my family would have one in their possesion. Sure, some of the features are nice (USB port, internal clock, library and clock usage in programming), but the calculator is slower than my TI-83 plus in some aspects! (I've done tests to prove that) That calculator is all looks. TI basically put too much memory in a calculator and gave it a processor that can't handle it at a manageable speed and it's disappointing. They need to spend their efforts right now on developing their hardware to work better rather than their programming utilities and languages, etc.
Anyhow, I'm done rambling. Sorry if my views have offended anyone.

Reply to this comment    24 October 2005, 05:45 GMT

Re: Is it Time to Replace TI-BASIC?
Gyerald  Account Info

I agree.
We Need something so easy like TI-Basic but faster than it.

Reply to this comment    29 October 2005, 15:50 GMT

Re: Is it Time to Replace TI-BASIC?
slugzzz  Account Info
(Web Page)

If you are a math student like myself, you realy are not looking for some elaborate programming platform anyhow. BASIC does it for me because, let's face it... what is the point of all the glits and glam when all that I need to do is solve 3x+2y-5=3,3x+3y+0=4,3x+4y-5=2 as an augmented matrix. If you want to program games and such, then yes I do agree that C and C++ are better platforms... but all I need to do is get my homework done.

Reply to this comment    9 November 2005, 07:21 GMT

Re: Is it Time to Replace TI-BASIC?
Philip Linde  Account Info
(Web Page)

Great article!

BASIC has been around for a while and it is known for being easy to read. However, it gets worse the more complicated the program is with all nested GOTOs and, on the calculator, no indented rows or anything to remind you of where you are.

If you simply want to print a comparison between two tables BASIC is fine. But when it comes to actually doing something fast and large it's borked... BASIC is GREAT for calculators though; you can only see 8 rows and 16 columns on the TI-83. I'd go completely nuts if I were to write C with a workspace that small, but with BASIC it's fine.

If I had the brains to write a language (for a calculator) I'd go with a really simple one: C-like syntax (with functions loadable from external files), five data types (int, float and string), single dimensional arrays (you really don't need more - you can always simulate multidimensional arrays) and maybe most importantly: parametric polymorphism. The float 128.5 would be read by a string fuction as the string "128.5". By an int function it'd be read as 129 etc. A string fed into an int or float would always be 0. You could overload any function.

This would cover the most basic things, but still it'd be overly complicated.

I say stick with BASIC if you want to program with the calculator - it isn't made for C# .NET or whatever.

I'd like to see an on-calc implementation off Small-C though, but it'd never replace BASIC.

Reply to this comment    10 January 2006, 21:02 GMT

Re: Is it Time to Replace TI-BASIC?
trigkid213 Account Info

I'd really appreciate an upgrade of TI-Basic. I'm just starting to learn asm but the calculator is a lot more convenient. I spend a lot of time programming in school during boring classes, which I couldn't do with asm. It would definitely be nice to get a faster, more powerful version.

I also think that a new TI-Basic should allow you to type commands insted of having to find them in the catalog. It is kind of annoying, and if you have a calc-compatible keyboard it would be a lot faster just to type.

Reply to this comment    23 January 2006, 19:47 GMT

Re: Is it Time to Replace TI-BASIC?
StuffPosingAsMail  Account Info

So, I have a couple more things to say on this topic. First off, it would be nice to have a more powerful language, like maybe if they added in better string manipulation tools. Also better calculator communication tools; I just use Omnicalc's lately because I can't get the built in ones to work how I want them to. I've been trying to make an IM program that would have been easier to write if I could have had a singular program to put on both calculators rather "program1" and "program2", like is usually done, and have the calculators automatically detect the place that each is in so they will be able to update at proper times and use different variables. Anyhow, I've run into a lot of bugs and realized that it's nearly impossible to do such a thing. I got pretty dang close, but I still have to say I'm aching for a more powerful language. For one, I need to learn ASM, but I can't find a compiler and Documentation that match or just a compiler that uses a Silver USB link cable. I want to learn to program in Hex on my calculator, but I don't know anywhere where I can get such tools. Can anybody help me?
Anyhow, as I was saying, the string manipulation is the pits, too. Maybe I'm just spoiled from using such languages as Visual Basic and similar ones, but there are only 3 or 4 string manipulation comands that I know of on the calculator. This is one feature that would especially be nice.

So, now I have to represent the other side.
TI-BASIC is still very useful. I write all kinds of programs for Calculus class that have quite a bit of use in the end and make tedious calculator calculations faster. What's more, when you get the hang of TI-BASIC, such programs can be written very efficiently and in a matter of minutes. It still is a useful language, and sometimes I would rather have a faster speed in writing the program than execution. I don't know.

Reply to this comment    25 February 2006, 06:50 GMT


Re: Re: Is it Time to Replace TI-BASIC?
ericva1992 Account Info
(Web Page)

LOL, you're gonna learn hex? that'll take a while memorizing what all the asm commands translate to.

As for compiling stuff (you've probably heard this before) get TASM. It's DOS and I know it's hard for beginners, but just take the "Learn ASM in 28 days" tutorial, and it'll teach you how to set up and use TASM. That's what I did, and it worked great. Now I'm writing a VB program that will let you edit+compile your programs directly into a calc program file, and optionally launch an emulator.

Reply to this comment    29 June 2006, 16:00 GMT

Re: Is it Time to Replace TI-BASIC?
Scooblescott  Account Info

man, that was a long, boring LECTURE. There is nothing wrong with basic, and nothing wrong with assembly; quit whining

Reply to this comment    26 February 2006, 17:28 GMT


Re: Re: Is it Time to Replace TI-BASIC?
evoVIII Account Info
(Web Page)

totally right, all languages have advantages and disadvantages, and BASIC is cool.
so yeah, quit whining.

Reply to this comment    8 March 2006, 15:02 GMT

Re: Is it Time to Replace TI-BASIC?
mohaas05  Account Info

I love TI-BASIc because I can program anywhere. I've never been able to learn asm so I just program on the way to school or during lunch. But I do wish you could do more with basic. Perhaps TI can include Exec( for calling functions just like on the 68k calcs.

P.S. Just so you know, I have a TI-83+ and an 84+SE

Reply to this comment    29 April 2006, 15:07 GMT


Re: Re: Is it Time to Replace TI-BASIC?
FallenGhost Account Info

We know we can compile ASM programs. We know that the calculator, whatever it is, can convert TI-BASIC into machine code or ASM or whatever it translates it into.

So if the calculator is able to convert, how come we aren't able. I'm no nerd in programming (i'm lost in ASM's basics), but I have a suggestion:

Why don'T we do a compiler for TI-BASIC?

We write in TI-BASIC in our computer. We use the compiler. Poof! Translated in whatever the calculator reads (hexa, asm, or binary) and everyone is happy: esay to do, fast, powerful.

The only problem is to actually program the compiler, which would need really good people... and a lot of time!

Reply to this comment    19 May 2006, 20:26 GMT

Re: Re: Re: Is it Time to Replace TI-BASIC?
ericva1992 Account Info
(Web Page)

There are a couple of compilers out there that convert basic > asm, but none of them seem to work :(

Plus, (correct me if i'm wrong) if you convert the basic directly to asm with no optimization and stuff, it would run at exactly the same speed as the basic did originally. I guess if you had it on a computer you could edit the ASM and stuff, but the program's gonna be huge and run slow anyway, so theres really no point in adding extra asm features.

Reply to this comment    29 June 2006, 15:56 GMT


Re: Re: Re: Re: Is it Time to Replace TI-BASIC?
FallenGhost Account Info

But if you could translate it in asm by a BASIC->ASM converter (like the one the calc uses), and then that you could open that asm program and then optimize it and get all the useless stuff out.

Also, on the calculator, the thing that takes most time is probably the converter and not the useless asm code...

Reply to this comment    12 July 2006, 12:08 GMT


Re: Re: Re: Is it Time to Replace TI-BASIC?
darren lee heywood  Account Info

Well said, the future is basic compilers, I am using 8051 micro BASCOM 8051 basic type compiler, it's totaly excellent and very easy to use.
Whats needed is a TI basic compiler that codes and compiles on a PC down to machine code(hex dump), this dump can then be downloaded to your calc. and run. The problem with c is that it is unnecessary hard to learn, in fact I would say it requires total professional tuition in order to become proefficient.
Darren

Reply to this comment    14 September 2006, 12:03 GMT

Re: Is it Time to Replace TI-BASIC?
Samnsparky  Account Info

Yea, it's time get a new language. It's just that asm is too much of a hassel to learn for alot of programmers, and Ti-basic only takes a day. I would be fine programming n C++ or C. Basically its just the speed. The calculator itself is just too weak.

Reply to this comment    26 July 2006, 21:11 GMT

Re: Is it Time to Replace TI-BASIC?
Ray Perry  Account Info

I believe that replacing BASIC wouldn't be a wise thing to do. I mean, it's always available and it's very versatile. *lightbulb clicks on in head*

NEW IDEA!!! *runs off*

Reply to this comment    14 November 2006, 03:41 GMT


Re: Re: Is it Time to Replace TI-BASIC?
Ray Perry  Account Info

Let me rephrase my previous comment. BASIC shouldn't be replaced. It should be improved.

Reply to this comment    14 November 2006, 13:41 GMT

Re: Is it Time to Replace TI-BASIC?
ertrules22 Account Info

Why? Is TI-BASIC really all that bad? I mean, it is a freaking calculator for cyring out loud, and if you want it to run faster than learn C or C++. Of course the language wasn't built for speed, it was just built for the user to optimize his/her calculator and make more features available that weren't in the original planning. Leave BASIC alone, sure you can optimize it, but it was made for calculators not for computers. The whole point is to add more features to your calculator. And who cares about graphics? I mean how much do you want from 94x62 black and white pixels?

Reply to this comment    3 January 2007, 02:03 GMT


Re: Re: Is it Time to Replace TI-BASIC?
ertrules22 Account Info

Oh yeah, and asm is just too darn confusing for most people that use BASIC, and that's why they use it and like it, because it is easy. You can learn and master BASIC in a week, but asm is almost as hard to master as it is to gain a mediocre knowledge of C or C++ in my opinion.

Reply to this comment    3 January 2007, 02:07 GMT


Re: Re: Re: Is it Time to Replace TI-BASIC?
ertrules22 Account Info

Let me rephrase that last comment, asm is freaking hard and so is C/C++ for some of us (me included) so BASIC is easy for me and 98% of Calc owners, where other languages are difficult for us to digest.

Reply to this comment    3 January 2007, 02:11 GMT

1  2  3  4  5  6  7  

You can change the number of comments per page in Account Preferences.

  Copyright © 1996-2012, the ticalc.org project. All rights reserved. | Contact Us | Disclaimer