TAL Programmer's Guide
Formatting Programs
Structuring Programs
3–14 096254 Tandem Computers Incorporated
Formatting With Comments You can insert comments anywhere in the source code to make the code easier to
understand and maintain. For instance, you can explain the purpose of certain
constructs or variables. During compilation, the compiler ignores comments.
You can specify comments using either of two forms or can use both forms in the same
compilation unit:
Beginning Delimiter Ending Delimiter Example
Two hyphens End of line --One form of comments
Exclamation point Exclamation point or end of line !Another form of comments
Explaining the Purpose of Variables
Comments can explain the purpose of variables:
INT num1; --16-bit simple variables
INT num2; -- to use for processing
INT num3; -- integer values
STRING char1; --8-bit simple variables
STRING char2; -- to use for processing
STRING char3; -- ASCII characters
PROC format_proc MAIN; --Declare FORMAT_PROC
BEGIN
--Assign values to variables
num1 := 8;
num2 := 5;
num3 := num1 + num2;
char1 := "A";
char2 := "B";
char3 := "C";
--Code to process the variables
END; --End FORMAT_PROC
Documenting Omitted Parameters
Comments within a CALL statement can help identify omitted parameters:
PROC some_proc (index, num, length, limit, total)
EXTENSIBLE;
INT index, num, length, limit, .total;
BEGIN
!Lots of code
END;
PROC caller_proc;
BEGIN
INT total;
!Some code
CALL some_proc (0, !num!, !length!, 40, total);
END;