USM LINKS

Computer Science

Mathematics

Physics

Mathematical Sciences




WEB PAGES

CMInfo

USM Pages

Campus Info




RESOURCES

Math Resources

Search Engines

Pax Index


SYMPOSIUM MINISYMPOSIA

What's New

FIRST SOUTHERN SYMPOSIUM ON COMPUTING

December 4-5, 1998
University of Southern Mississippi
Hattiesburg, Mississippi


ABSTRACT

Indentation, Double Blanks, and Language Design

W. Douglas Maurer

The readability of future algebraic languages may be considerably improved by the use of two features which seem so far to have been ignored. The first is the use of indentation in a meaningful way. As a simple example, consider how the construction

        if condition
         statement-1
        else
         statement-2
         statement-3
        next-statement
improves readability. The else-part now consists of all statements between 'else' and the next statement (in this case statement-2 and statement-3) which are at an indentation level higher than that of 'else'. All statements between 'if' and 'else' at a higher indentation level that that of 'if', in a similar way, form what is usually called the then-part, although there is no longer any need for the word 'then'. Similarly, there is no need for parentheses around 'condition' (as in C); 'begin' or 'end' (as in Pascal); END IF (as in Ada); curly brackets (as in C); or indeed any distinction whatsoever between a single statement and more than one statement in a group. The second feature suggested here is the use of two or more blanks in a row as a separator, much like the semicolon in languages of today, with the semicolon reserved for special usages. As an example, consider the C-like syntax
        for (initialization; test; increment)
         statement-1  statement-2  statement-3
        next-statement
Here there are two blanks between statement-1 and statement-2, and similarly between statement-2 and statement-3. No semicolons are needed, and two blanks are actually faster to type than a single semicolon. More than two blanks in a row are treated as if there were only two, and hence there cannot be two such separators in a row. This is why we continue to use the semicolon before and after 'test', since 'test' can be null and hence two semicolons may still occur here in a row.

The full paper will concern itself with the following issues:

  1. Other keywords which likewise become unnecessary (such as Ada's LOOP, END LOOP, END WHILE, and, less obviously, ELSIF).
  2. Ways of indicating indentation change, noting that change may be by 1, by -1, or by -n for n > 1, but not by n for n > 1.
  3. Rules for very long lines, indenting continuation lines by two levels (introducing no ambiguity here because of the preceding rule).
  4. Rules for several statements of different statement types on one line.
  5. Rules for very large numbers of indentation levels.
  6. Distinction between declaration and definition of a procedure or function, in that only a definition is immediately followed by a line at the next higher indentation level.
  7. Other issues such as editor design, case statement design, and the like.


Getting More Information

To obtain more information about the meeting send e-mail to: fscc98@pax.st.usm.edu.


Return to PAX
Return to USM

USM
inquire@delphi.st.usm.edu
Updated
http://pax.st.usm.edu