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?
anthony C  Account Info

I would have to agree with many of his premises: TI-BASIC is good for basic programs, or programs that don't require speed, but isn't good for high graphics, speed, ec. While assembily on the other hand has terrific speed, is as capable as TI-BASIC when it comes to features, but it is a hassle to program (takes a lot of time to learn), and is dangerous to make an error in (RAM erases).

There is one other language he hasn't mentioned for the TI, and that is the C language. For the 68k calcs there is TIGCC, and EXCELLENT comiler that compiles C code into calculator assembler. It is nearly as fast as hand-coded assembly, and is much easier to understand then programing into assembly directly. There is also a C-compiler for the Z80 calcs, although not as developed as TIGCC. It seems that C is a blend between ease of use (not as easy as TI-Basic, though), and speed.

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

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

Agreed. If you think TI-BASIC and assembly both sucks, then you should be using C.

Reply to this comment    21 February 2005, 14:07 GMT

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

I think that C is the best programming language but I don't think assembly is that bad... \:>

Reply to this comment    21 February 2005, 14:49 GMT

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

I don't think that either!

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


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

Yes, C and C++ are essentially the foundations to modern programming, but I also like Ruby. That would be a good implementation on the TI-Nspire, which already supports C with Ndless.

Reply to this comment    18 June 2012, 20:57 GMT

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

TI-BASIC doesn't suck, and neither does ASM. If u're a beginner programmer like me, BASIC is good, 'cuz it's simple, and u can program right on the caclulator. ASM, although is hard to master, will be very useful if u are thinking of becoming a real programmer, because it gives you sense of what the hell is going on inside the calc. So until u're ready for hardcore shit like ASM, shut the fuck up.

Reply to this comment    23 February 2005, 02:47 GMT

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

I totally agree. Basic is a very good starting language and after all this is a calculator we are talking about.
All my programming when my friend showed me a loop that no buttons(except the on) would stop it.
Because of that I now program in many other languages(c, c++) and script with torque.
Anyways its a calculator, we dont need to do mass programs and games and stuff, I have made games and programs and yes they could run faster but other than that the language is fine.
If you want to do ASM or C or w/e do it on a computer.
The main purpose I think of programs is for making the program solve equations, etc.
The calculator does not need to become a portable computer(although that would be nice)
If you are that into programming on a calculator DO IT ON A COMPUTER!

cal-cu-la-tor: n.
1.One that calculates, as:
a. An electronic or mechanical device for the performance of mathematical computations.
b. A person who operates such a machine or otherwise makes calculations.
2. A set of mathematical tables used to aid in calculating.

See not a device to play games on or make operating systems or flash programs. So, it is fine the way it is.

Reply to this comment    3 March 2005, 22:07 GMT


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

>If you are that into programming on a calculator DO IT ON A COMPUTER!

One of the main reasons to use a calculator instead of a computer is that YOU CAN CARRY IT AROUND! (I don't mean to start a flare or anything, I just wanted to state another side of this "argument"). Sure, some people say that if you want a portable supercomputer, you should get a Pocket PC, but a big problem with that is there is no easy-access built-in programming support. For people who are incredibly interested in programming, the graphing calculator is the way to go. I wanted a graphing calculator really bad when I was younger because it was a pocket interpreter; I could make/use programs anywhere I went.

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

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

I agree with this and IMHO, It's a lot cooler to have a calculator that can do everything instead of a Pocket PC that can do everything.

Reply to this comment    17 August 2005, 17:28 GMT


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

i agree with you. ti basic programming is so easy that everyone can do it. you can´t program everything, but the ti83p is no computer. those who want more schould sell their "minicomputers" and buy a pc.

Reply to this comment    12 February 2006, 17:27 GMT

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

>TI-BASIC doesn't suck, and neither does ASM. If u're a beginner programmer like me, BASIC is good, 'cuz it's simple

I would like to mention the programming language I started out with. It was an old Macintosh program called HyperCard. One thing that made it so unique is the way all of the commands are stated. For instance, a TI-Basic program might look like this:

Local i;
For (i,0,20)
Disp "Some text"+string(i)
EndFor

Where as a HyperCard program might look like this:

repeat with i=0 to 20
add "Some text"&i to card field 1
end repeat

As well, the second and perhaps biggest thing that made HyperCard so amazing was it's incredibly visual interface that surpassed even Visual Basic! If you are in browse mode, you can click on the buttons and fields and they do what they're told. If you are in editing mode, you can select buttons and fields to change their properties and script them. Like Visual Basic, HyperCard sets up routines for what happens when you do something to an object (i.e. buttons and fields). A button is obviously what it is: a button, radio button, check box, or popup. A field is simply a text box.

Sorry for babbling and babbling, but I just wanted to mention the programming language I began with when I was five years old going on six (yes, six!). I learned from example by looking at the scripts of programs already made. After a while, I eventually figured things out. I hope someone was somewhat inspired by reading all of that.

[Note] I had to delete a bunch of stuff because of the length limit.

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


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

I think they should add on to what they already have, like shortcuts for less "mess", and some asm-speed commands.

Reply to this comment    27 October 2005, 01:07 GMT

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

well TI-basic is ok... but Z80 Assembly is sooooooo hard.

Reply to this comment    25 September 2005, 01:25 GMT


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

Try looking at "Learn 83+ assembly in 28 days". It explains it really well, and I switched over from using BASIC overnight.

Reply to this comment    21 August 2010, 19:00 GMT


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

where is it?

Reply to this comment    2 October 2010, 10:29 GMT

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

Watch the language there

Reply to this comment    31 May 2006, 01:22 GMT

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

You know, you're sorta of right. Start out with the BASIC language then go to something harder language when you're ready. Also, I'd recommend using more milder languages when posting

Reply to this comment    25 September 2008, 10:29 GMT


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

I totally agree. and stop whining about his language. BASIC is beyond easy, so either do a computer language or actually try to learn ASM...

Reply to this comment    21 August 2010, 18:58 GMT

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

However, as the author suggest, a new highly optimized, strongly typed, interpreted language, can come handy for students who want to program on their calculators directly.

Reply to this comment    24 February 2005, 16:16 GMT

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

NO!!!!

TI BASIC is so good and easy to learn! Its a good starting language.

Reply to this comment    15 April 2007, 17:22 GMT


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

i think that we should keep ti basic as the defalt language but have other languages like c that you can override ti basic if you want to

Reply to this comment    28 September 2007, 13:23 GMT


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

Well, while Basic DOES need to be replaced, there isn't much capability on calculators for HLL's (except for maybe the N-Spire, which sucks in its own ways.)

I was trying to make my own On-Calc language a little while ago, called Lo-C (stands for Low level implemented C) but I quickly realized that a calculator with 24K ram isn't gonna cut it. Of course, I could read and write from archive, but who in their right mind want to download 200K of appvars that are needed to compile and run a game efficiently?

So before TI replaces BASIC, it'll have to replace the "cheaper" line of calculators as well (everything except N-Spire, which I still think sucks in many of its own ways :)

Reply to this comment    21 August 2010, 18:56 GMT


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

I think Basic is very good

Reply to this comment    9 March 2011, 01:50 GMT

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

I agree. C is a lot easier to understand and easier to program with. :)

Reply to this comment    22 February 2005, 00:49 GMT


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

C is much better for games but not as good for manipulating vareables.

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

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

C is great. I'm starting to learn it now. But, BASIC is more convienent because you don't have to do the programming on a computer. I like TIGCC, but C takes a while to learn. ASM is insane, I learned some when I had my old 86 and I was like, "ld a,8 .db 00000001"...dur.

What I'm trying to say is... while replacing BASIC would be nice, C is already there. However, I would be happy if someone made a mini-TIGCC for the 89. It would be nice to be able to do the core programming on the calc itself.

Reply to this comment    22 February 2005, 01:13 GMT


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

There is some on-calc C environment...it is on my calculator, but I do not seem to be able to recall the name. I found it somewhere in the TI-92+ stuff here.

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


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

Quote from anthony C:
"For the 68k calcs there is TIGCC, and EXCELLENT comiler that compiles C code into calculator assembler."

1. You misspelled an.
2. So what about the people with z80's? Huh? They're stuck between a particularly inefficient version of BASIC or a hard-to-learn assembly language capable of killing their calc. But the 68ks have stronger BASIC capabilities, an easier assembly language, AND TIGCC. Now how many people think this is unfair?

Reply to this comment    28 June 2006, 18:16 GMT


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

yes but he also says after your quote that:
"There is also a C-compiler for the Z80 calcs, although not as developed as TIGCC."

i have the ti-83 plus and i would be interested in programming in C for it.... need to google it....

Reply to this comment    4 January 2010, 18:29 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