Tiny BASIC - Implementation in Interpreted Language

Implementation in Interpreted Language

For some implementations, an interpreted language (IL) is used. (At least two later versions, Palo Alto Tiny BASIC and 68000 Tiny BASIC, are direct interpreters). 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 interpreted 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 interpreted 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 economized on memory space and implementation effort, although the BASIC programs run thereon were executed somewhat slowly. 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 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

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

Read more about this topic:  Tiny BASIC

Famous quotes containing the words interpreted and/or language:

    Well, I always say the law was meant to be interpreted in a lenient manner. And that’s what I try to do, is sometimes I lean to one side of it, sometimes I lean to the other.
    Irving Ravetch (b. 1920)

    English general and singular terms, identity, quantification, and the whole bag of ontological tricks may be correlated with elements of the native language in any of various mutually incompatible ways, each compatible with all possible linguistic data, and none preferable to another save as favored by a rationalization of the native language that is simple and natural to us.
    Willard Van Orman Quine (b. 1908)