Home  |   Notes  |   Languages  |   Programs  |   Homework

  General Description

SIMPLE is a low-level, imperative language for manipulating a single data type, strings. A SIMPLE statement always occupies exactly one line of a SIMPLE program. There are no control structures, including subprograms. SIMPLE is designed so that a SIMPLE program can be interpreted line by line, with no line repeated after it has been interpreted once.



Every SIMPLE statement must have a keyword as the first field (there may be white space before the keyword), identifying the kind of statement. All subsequent fields must be separated by white space and the last field msy be followed by white space that extends to the end of the line. Extraneous fields are always an error. A line that is all white space is syntactically correct and semantically ignored.

A field denoted {string} (or {string1}, etc.) may be either a previously declared identifier or a string literal (i.e., enclosed in double-quotes).

  An Example

Interpretation of the following SIMPLE program

var firstname
var lastname
var name
var street
var town
var state
var zip
var space
set space " "
set zip "24060"
set state			"virginia"
set firstname "Tommie"
set lastname "Loggerhead"
set street "1212 Hopping Lane"
set town "Blacksburg"
concatenate firstname firstname space
concatenate name firstname lastname
write name
write street
concatenate town town ","
concatenate town town space
concatenate town town state
concatenate town town space
comment		How long can this go on?
concatenate town town zip
write town
results in the following output to standard output:
Tommie Loggerhead
1212 Hopping Lane
Blacksburg, virginia 24060

Home  |   Notes  |   Languages  |   Programs  |   Homework

copyright © 2000 Virginia Tech, ALL RIGHTS RESERVED
Last modified: October 25, 2000, 08:11:42 EDT, by Lenwood S. Heath <heath@cs.vt.edu>