Teach Time Encyclopedia - Learn About Our World
Home Page
Teach Time
Featured Topics

United States
by state

CITYology

Academic Disciplines

Historical Timelines

Themed Timelines

Calendars

Reference Tables

Biographies

How-tos



Saturday, September 06, 2008

Tiny BASIC programming language

Tiny BASIC is a dialect of BASIC that can fit into as little as 2 or 3 KB of memory. This small "footprint" made it invaluable in the early days of microcomputers when typical memory size was 4K.

Table of contents
1 History
2 Tiny BASIC Grammar
3 Implementation
4 External links

History

The language was first developed solely as a standards document, written primarily by Dennis Allison, a member of the Computer Science faculty at Stanford University. He was urged to create the standard by Bob Albrecht of the Homebrew Computer Club. He had seen BASIC on minicomputers, and felt it would be the perfect match for new machines like the MITS Altair 8800 which had just been released in 1975.

Bob and Dennis published the design document in a newsletter they called the People's Computer Company. In December 1975, Dick Whipple and John Arnold created an interpreter for the language that required only 3K of RAM. Bob and Dennis decided to publish this version in it's own newsletter, which they called Dr. Dobb's Journal of Computer Calisthenics & Orthodontia. In the 1976 issues several versions of Tiny BASIC, including design descriptions and full source code, were published. The magazine exists today as Dr. Dobb's.

Tiny BASIC Grammar

line ::= number statement CR | statement CR

statement ::= PRINT expr-list |
                     IF expression relop expression THEN statement |
                     GOTO expression
                     INPUT var-list
                     LET var = expression
                     GOSUB expression
                     RETURN
                     CLEAR
                     LIST
                     RUN
                     END

expr-list ::= (string | expression) (, (string | expression) * )

var-list ::= var (, var)*

expression ::= (+ | - | epsilon ) term (( + | -) term) *

term ::= factor ( (* | / ) factor) *

factor ::= var | number | (expression)

var ::= A | B | C .... | Y | Z

number ::= digit digit *

digit ::= 0 | 1 | 2 | 3 | ... | 8 | 9

relop ::= < ( > | = | | epsilon ) | > ( < | = | epsilon ) | =

A BREAK from the console will interrupt execution of the program

From Dr. Dobb's Journal of Computer Calisthenics & Orthodontia, Volume 1, Number 1, 1976, p. 9

Implementation

For the implementation a interpretive language (IL) is used. An interpreter written in IL interpretes a line of Tiny Basic code and executes it. The IL is run on an abstract machine, which interpretes IL code. The idea to use an interpretive language goes back to Val Schorre (with META-II, 1964) and Glennie (Syntax Machine). See also virtual machine, CLI.

Interpretive language

The following table gives a partial list of the commands of the interpretive language in which the Tiny Baisc interpreter is written. The length of the whole interpreter program is only 120 of IL operations. Thus the choice of an interpretive approach allowed to economize on memory space and implemenatation effort, though the programs as such were executed somewhat slower. (Source: Dr. Dobb's Journal -Volume 1 Number 1, 1976 p. 12)

TST lbl, 'string' If string matches the BASIC line advance cursor over the matched string and execute the next IL instruction

If the test failes execute the IL instruction at the label lbl

CALL lbl Execute the IL subroutine starting at lbl. Save the IL address following the CALL on the control stack
RTN Return to the IL location specified at the top of the control stack
DONE Report a syntax error if after deleting leading blanks the cursor is not positioned to reach a carriage return.
JUMP lbl Continue execution of the IL at the label specified.
PRS Print characters from the BASIC text up to but not including the closing quotation mark
PRN Print number obtained by popping the top of the expression stack
SPC Insert spaces to move the print head to next zone
NLINE output a CRLF to the printer

External links



Internet Hotel Solutions

Site Sponsors
AC Units
Baltimore Harbor
Boot Camp Grads
Bra Size
Burkittsville
College Hotels
Digital Harbor
Free Cell Phones
Golden Hare Travel
Golf Vacations
Golf Courses
Gourmet
Hair Styles
Hippodrome
iWoman
Lesson Plans
Maryland Hotels
MD Genealogy
Minor League Stuff
Motel Site
Ocean City
OC Real Estate
Old Agers
Office Supplies
Orlando
Pet Friendly Hotel
Room Prices
Savannah, GA
Ski Vacations
South Baltimore
Student Teaching
Travel Sources
University Hotels
Visit Military Bases
Washington, DC

Brought to you by NoChildLeftBehind.com and the Beaches and Towns Network, LLC.