Tiny BASIC

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 (the mid-1970s), when typical memory size was 4–8 KB.

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 MITS Altair 8800, which had been released in January 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 as its 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 (as of 2004 the newsletter still exists, in the form of professional programmers' magazine Dr. Dobb's Journal).

Tiny BASIC grammar

The grammar is listed below in Backus-Naur form. In the listing, an asterisk ("*") denotes zero or more of the object to its left — except for the first asterisk in the definition of "term", which is the multiplication operator; parentheses group objects; and an epsilon ("ε") signifies the empty set. As is common in computer language grammar notation, the vertical bar ("|") distinguishes alternatives, as does their being listed on separate lines. The symbol CR denotes a carriage return.


   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 ::= (+|-|ε) 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 ::= < (>|=|ε) | > (<|=|ε) | =

   A BREAK from the console will interrupt execution of the program

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

Implementation by interpretive language

For the implementation a interpretive language (IL) is used. An interpreter written in IL interprets a line of Tiny Basic code and executes it. The IL is run on an abstract machine, which interprets 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.

The following table gives a partial list of the commands of the interpretive language in which the Tiny BASIC interpreter is written. The length of the whole interpreter program is only 120 IL operations. Thus the choice of an interpretive approach allowed to economize on memory space and implementation effort, though the BASIC programs as such were executed somewhat slow. The CRLF in the last line symbolizes a carriage return followed by a line feed.

TST lbl, string If string matches the BASIC line, advance cursor over string and execute the next IL instruction; if the test fails, execute the IL instruction at the label lbl
CALL lblExecute the IL subroutine starting at lbl; save the IL address following the CALL on the control stack
RTNReturn to the IL location specified at the top of the control stack
DONEReport a syntax error if after deleting leading blanks the cursor is not positioned to reach a carriage return
JUMP lblContinue execution of the IL at the label specified
PRSPrint characters from the BASIC text up to but not including the closing quotation mark
PRNPrint number obtained by popping the top of the expression stack
SPCInsert spaces to move the print head to next zone
NLINEOutput a CRLF to the printer

Source: Dr. Dobb's Journal, Volume 1, Number 1, 1976, p.12.

External links

  • Tiny Basic User Manual (http://users.telenet.be/kim1-6502/tinybasic/tbum.html) and Eksperimenter's Kit (http://users.telenet.be/kim1-6502/tinybasic/tbek.html) – By Tom Pittman
  • Giovanni Moretti's lecture notes in Systems programming (http://www-ist.massey.ac.nz/GMoretti/159704/sitemap.html) – With Tiny BASIC as a programming language example
  • TINY BASIC (http://www.jollyp.demon.co.uk/port/download/pages/language.html) – Mid-80s version based on Li-Chen Wang's Palo Alto 8080 TINY BASIC as published in the May '76 Dr. Dobb's
  • TBL (http://www.multicians.org/raf-tbl-definition.html) – A similar IL to Tiny BASIC's, used in the first successful compilers for PL/I, Fortran, etc, on limited memory minicomputers
  • M68000 Tiny BASIC (http://members.shaw.ca/gbrandly/68ktinyb.html) – Based on Li-Chen Wang's work, and published in the 100th edition of Dr. Dobb's
  • Tiny BASIC (http://smallbasic.sourceforge.net/sb/tiny.txt) – An implementation written in SmallBASICja:Tiny BASIC
Navigation

  • Art and Cultures
    • Art (https://academickids.com/encyclopedia/index.php/Art)
    • Architecture (https://academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (https://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (https://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools