TAL Programmer's Guide

Formatting Programs
Structuring Programs
096254 Tandem Computers Incorporated 3–13
Formatting Programs You can format a program to make it easier to understand and maintain. The TAL
compiler allows almost a free format for source code. You can use any format that
serves your purposes. The only limitation is that the maximum line length for source
code is 132 characters.
Here is an example of a format that is difficult to read:
INT num1;INT num2;INT num3;STRING char1;STRING char2;STRING
char3;PROC format_example MAIN; BEGIN num1 := 8; num2 := 5;
num3 := num1 + num2; char1 := "A"; char2 := "B"; char3 :=
"C"; END;
Here is an example of a format that is easy to read:
INT num1;
INT num2;
INT num3;
STRING char1;
STRING char2;
STRING char3;
PROC format_example MAIN;
BEGIN
num1 := 8;
num2 := 5;
num3 := num1 + num2;
char1 := "A";
char2 := "B";
char3 := "C";
END;
In the second format, you can readily see each declaration. You can tell where the
global declarations end and the procedure begins. You can quickly see what the
procedure body contains. You have space to add comments to clarify what is going on
in the program.