Jump to content

FLOW (programming language)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Maury Markowitz (talk | contribs) at 16:16, 5 November 2019 (Interactive commands). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
FLOW
ParadigmNon-structured
Designed byJef Raskin
First appeared1970; 55 years ago (1970)
Influenced by
BASIC

FLOW was an educational programming language designed by Jef Raskin in 1970 and implemented on several minicomputers in the early 1970s. The goal of the language was to make it easy to explore algorithms through a highly interactive environment. The overall language is very similar in syntax and structure to the BASIC programming language, but has a number of changes in order to make typing code easier. Most notable among these was the concept of "typing amplification", in which short strings, often a single character, were expanded by the language into the complete "unamplified" source code.

History

In 1970, the English Department of the University of Kansas hosted a meeting on the use of computers in the humanities. The conference was followed by a training session that ran from June 13 to August 18, where Jef Raskin was one of several teachers involved in training other teachers basic computer skills. During this period, Raskin developed the FLOW language concept.and two of his graduate students implemented it.[1]

A key design element of FLOW was the attempt to avoid syntax errors by automating the entry of the language as much as possible. For instance, if one wanted to enter the statement PRINT "10", the user simply had to type P10 and the interactive editor would expand it out as they typed. If the user entered an illegal command, it would flash on the terminal and then be automatically erased so the user was "none the worse for hitting a wrong key." They referred to this concept as "typing amplification", and noted that it had the added advantage of removing an impediment for slow typers or those with physical problems using a terminal.[2]

Lewis and Norman later referred to this concept as "gag", in that it gagged the user's input until they typed something useful. They illustrated this by recounding one of Raskin's favorite demonstrations of FLOW, where he would close his eyes and hit random keys on the terminal, building a syntactically correct, albiet meaningless, program.[3]

Another aspect of the FLOW system's approach to user interaction was its debugger. This included the command WALK, an analog to BASIC's RUN that delayed after executing each statement in a fashion similar to modern single-step systems.[4][3]

Raskin was able to arrange funding from the University of California, San Diego and matching funds from the National Science Foundation to purchase equipment to develop the FLOW system, a total of $76,000 (equivalent to $615,359 in 2024).[5] The initial system consisted of three Data General Nova minicomputer with 12k words of memory, several VST 1200 terminals, a Tektronix 4002 graphics terminal, and an HP 7200 plotter. In September 1973 the CPUs were updated to 32k words of memory.[6]

The original version was implemented in FORTRAN but later ported to Nova assembler language. Later ports included MICRO 800 assembler, BASIC and Algol.[6]

Description

Overall organization

Like BASIC, FLOW used line numbers both as an editing aid as well as statement labels. Unlike most BASICs, FLOW automatically numbered programs starting at line 10 and incrementing by 10 as new lines were entered. The line numbers were formatted as three digits, so line 10 was displayed as 010. User could enter line numbers manually, and renumber the entire program with the NUMBER command. In contrast to BASIC, the RUN command could be instructed to stop once a given line was reached, for instance, RUN FROM FIRST LINE TO 200. To enter this command, the user simply typed RF200, with the rest being "amplified" into the command line.[5]

The most obvious difference between FLOW and BASIC was that FLOW lacked variables and mathematical operators. The language had only seven statements, all of which applied basic logic or string manipulation. There was no equivalent of for loop either, looping was handled entirely through IF tests and JUMP TO statements.[7]

The language did not have direct user interaction like BASIC's INPUT, data was instead defined in FLOW's analog of BASIC's DATA statement, TEXT. TEXT IS defined a quote-delimited string, like TEXT IS "HELLO, WORLD", which was then read character-at-a-time using the GET IT. IT is a meta-variable that contains the last read character, and can then be used in other statements, like PRINT IT. IT becomes a blank -not an empty string but a single space- when the TEXT is completely read.[5]

Programs can contain multiple TEXT statements, but unlike BASIC's DATA where all of the lines are considered to be one continuous block of data, only one TEXT statement is active at a time as they are encountered by the interpreter. In other words, if there are two TEXT statements in a program, they are not treated as one longer statement as is the case with DATA, IT will return a blank when it runs off the end of the active TEXT statement and will not return more data until the next TEXT statement is encountered in the code.[5]

Statements

Program statements

COMMENT - equivalent to BASIC's REM
PRINT - as in BASIC, takes literal strings between double quotes, the IT variable, or ON A NEW LINE to print a carriage return.
TEXT IS - similar to DATA in BASIC, but used for strings only
GET IT - reads the next character from the current TEXT statement
JUMP TO - equivalent to GOTO, always expands target lines to three digits
IF IT IS ... JUMP TO - equivalent to IF...THEN but can perform only equality tests against IT
STOP - used to end a program, but not required

Interactive commands

RUN - as in BASIC but can define both the start and end lines and use meta-lines FIRST LINE and END
WALK - executes the program slowly
DISPLAY - equivalent to LIST, but no default to "the entire program". To list the entire program, one uses DISPLAY FROM FIRST LINE TO END
ERASE - remove lines from a program, ERASE FROM 038 TO 140
NUMBER - renumber the lines in the program

Example

010 COMMENT FIND IF A WORD HAS EITHER AN "F" OR A "G" IN IT
020 COMMENT BY LYRA FORET 19 OCTOBER 1971
030 COMMENT
040 COMMENT SOME TEST CASES ARE FOX, GOPHER, RAT, DOG, CAT
050 COMMENT THE RESPECTIVE ANSWERS SHOULD BE YES, YES, NO, YES, NO.
060 COMMENT
070 TEXT IS "DOG"
080 COMMENT OBTAIN A LETTER OF THE TEXT
090 GET IT
100 COMMENT CHECK FOR A BLANK WHICH INDICATES END OF WORD
110 IF IT IS " " JUMP TO 500
120 COMMENT CHECK FOR F'S OR G'S
130 IF IT IS "F" JUMP TO 200
140 IF IT IS "G" JUMP TO 200
150 COMMENT IT WAS SOME OTHER LETTER, SO GO ON TO THE NEXT CHAR. IN THE TEXT
160 JUMP TO 080
200 PRINT "THE WORD HAD AN 'F' OR A 'G' IN IT."
210 COMMENT WE ARE DONE
220 STOP
500 PRINT "THE WORD DID NOT HAVE AN "F' OR A 'G' IN IT." 

References

Citations

  1. ^ Raskin 1974, p. 231.
  2. ^ Raskin 1974, p. 232.
  3. ^ a b Lewis & Norman 2014, p. 691.
  4. ^ Raskin 1974, p. 233.
  5. ^ a b c d Raskin 1974, p. 234.
  6. ^ a b Raskin 1974, p. 237.
  7. ^ Raskin 1974, p. 235.

Bibliography

  • Raskin, Jef (July 1974). "FLOW: A Teaching Language for Computer Programming in the Humanities". Computers and the Humanities. 8 (4): 231–237. doi:10.1007/BF02402344. {{cite journal}}: Invalid |ref=harv (help)
  • Lewis, Clayton; Norman, Donald (2014). "Designing for Error". In Baecker, Ronald (ed.). Readings in Human-Computer Interaction: Toward the Year 2000. Elsevier. pp. 686–697. {{cite encyclopedia}}: Invalid |ref=harv (help)

Further reading

  • Flow, a modern implementation of FLOW in LISP