Encyclopedia > Tiny BASIC programming language

  Article Content

Tiny BASIC programming language

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

Table of contents

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 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



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
Digital Rights Management

... Web site (www.freedom-to-tinker.com) for some observations on the DCMA, its proposed successors, and their consequences, intended and unintended hilarious ...

 
 
 
This page was created in 27.9 ms