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
|
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: Is it Time to Replace TI-BASIC?
|
Andy Dang
(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
|
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
|
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
(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
(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
|
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
|
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: Is it Time to Replace TI-BASIC?
|
Scooblescott
|
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: Is it Time to Replace TI-BASIC?
|
mohaas05
|
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
|
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: Is it Time to Replace TI-BASIC?
|
Samnsparky
|
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
|
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: Is it Time to Replace TI-BASIC?
|
ertrules22
|
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
|
|
1 2 3 4 5 6 7
You can change the number of comments per page in Account Preferences.
|