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?
Lewk Of Serthic  Account Info
(Web Page)

The real question is weither or not someone will step forward.

Reply to this comment    21 February 2005, 05:13 GMT

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

I definitely agree with the author. I mean, has anyone noticed that better games are made with assembly language and C instead of BASIC and how everyday a new program in BASIC is released? It's because it's so easy to make a single program in BASIC without consuming time or patience. A new language would probably be a great idea to replace BASIC. Don't get me wrong: BASIC isn't bad nor the people who use it, but it's time to step it up a notch and say that BASIC is for beginners and that we should move onto assembly or this "hypothetical language" the author talks about. I mean, I'm not BASICist or whatever, but I'm saying that a "new language" would be better

Reply to this comment    21 February 2005, 05:27 GMT

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

there is a new lan. for z80s. well ti 86 right now but check out the forums
web site in link

Reply to this comment    21 February 2005, 06:08 GMT


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

This looks really awesome. I was looking into using TI Power to program for the 86, but this language looks just as powerful and maybe even more versatile since it can be programmed on-calc. If it gets implemented for all of the calcs, the potential will be very big for this. Everyone should take a few minutes to check this out.

Reply to this comment    21 February 2005, 08:52 GMT


Re: Re: Re: Re: Re: Is it Time to Replace TI-BASIC?
Rob van Wijk  Account Info

It won't be implemented for the 83ish calcs I think; it used way too many characters the calc can't display, or can't display without a bunch of tricks.

Reply to this comment    21 February 2005, 22:06 GMT

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

It may actually happen though. I was looking at their message boards and as of a few days ago, the 83+ version was well on its way (probably about half done), and it is moving forward quickly. Hopefully it will be released within a month.

Reply to this comment    23 February 2005, 04:21 GMT


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

Uh, probably not within the month, but fairly soon, I think (I'm a member of the programming team).

It wouldn't completely replace BASIC, since it doesn't support floating-point numbers and doesn't have trees or stuff like that, but it is a replacement for BASIC as far as gaming.

Reply to this comment    26 February 2005, 02:09 GMT


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

The language is desined to work with an 8x16 screen(83 series).This, as far as i can tell should work with all TI calcs when they finish the programing.

Reply to this comment    1 March 2005, 15:08 GMT

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

If you like redux's work, you should subscribe to "Calculate!" it is the CalcGames.org newsletter.

Reply to this comment    21 February 2005, 06:37 GMT

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

As far as a new language for the calculators, I think LISP would be awesome, if it would be fast enough & not use all the memory...perhaps it might work on the TI-89/92+, at least. Or maybe some cross between TI-BASIC & C would be good. I have seen a C interpreter before...maybe add error checking to make it stable.

Reply to this comment    25 February 2005, 05:26 GMT


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

What about Tcl?

Reply to this comment    10 February 2006, 21:36 GMT


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

Haven't you noticed any BASIC programs that are way better than some Assembly programs cause I have. But I do agree not with a new language but with a C compiler for the 83/84 series or a TI-BASIC compiler.

Reply to this comment    9 September 2006, 16:03 GMT

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

How about TI finally steps over!

Reply to this comment    22 February 2005, 02:14 GMT


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

>>steps FORWARD...

Reply to this comment    22 February 2005, 21:47 GMT

[ ! ]
anykey  Account Info
(Web Page)

Steps backwards.
EOL

Reply to this comment    23 February 2005, 03:57 GMT


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

This is an interesting proposition which I've never thought of before. Should TI create a new language? Personally, I like the idea. TI-BASIC bugs me with its limitations, and I think if TI worked at it they could come up with a nice new language for their calculators using some tips based on the points the author of this article made.

However, this would _probably_ require TI to come out with a whole new series of calculators. Whether that is a good thing or a bad thing, at this time, I don't know. The plus side would be (obviously) having a new calculator, and hopefully, they'd add some other cool features to this calculator if they were to make another (perhaps some discussed in older threads). I'd definitely like that, however, if they did come out with a new calculator series, which they'd have to, they'd probably drop support on some of their other models. (Remember how they ditched the TI-86? :-P)

Implementing a new language without majorly changing the model would be tough. This would be beyond my level of comprehension, so I can't say how doable this is, but it seems to me that if TI were to adopt an entirely new language, they'd make a new model or series. Besides, new calculator = more money for them.

Reply to this comment    23 February 2005, 20:59 GMT

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

On United-TI, several people have talked about ideas for a new programming language. Try going there (link above) to share your ideas with people who might actually do something with them. Also, I think that BASIC might take longer to learn well than assembly. Contra 83 is an example of a high-quality BASIC game for the TI-83+. What would really help is more rating of the low-quality games.

I don't really feel a need right now for another language besides BASIC or assembly, though. If I want to program in a powerful higher-level language, I would use a computer. The purpose of BASIC, besides for making math homework easier, is to work against the limitations of the language and still make impressive programs (like Contra). Assembly is for making programs that are too complex for BASIC. By the way, strings in BASIC are often helpful for some of the problems mentioned in the article.

Reply to this comment    21 February 2005, 06:36 GMT

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

OK, BASIC definetly isnt the fastest or most space conserving language, BUT it is a lot safer and easier to use for some people and for those of us who havent learned assembly yet, it is our only way of programming. I think that any idea of replacing BASIC is obsurd and should NOT even be considered.

Reply to this comment    21 February 2005, 15:29 GMT

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

I don't agree completely with what you said, but I do agree that a major point the author didn't mention in the article was that assembly is hard to learn. I have learned some Z80 assembly, but it was really difficult to understand. Difficulty is an important factor to consider when choosing a programming language for most people to use.

Reply to this comment    21 February 2005, 17:21 GMT


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

I don't think basic needs to be replaced, just come out with another language and leave basic in place.

Reply to this comment    21 February 2005, 18:02 GMT


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

I have to agree on that one. I think that BASIC should be left on and just add a C/perl/ect. compiler for the more advanced programing.

Reply to this comment    21 February 2005, 21:20 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