Details on the components of the system
take a number of options.\*(dg
to translate Pascal programs,
We refer to them here, however, as
convention for passing options to programs on the command line,
and this convention is followed by the
As we saw in the examples above,
option related arguments consisted of the character `\-' followed
by a single character option name.
In fact, it is possible to place more than one option letter after
There are 26 options, one corresponding to each lower case letter.
which takes a single digit value,
each option may be set on (enabled)
When an on/off valued option appears on the command line of
it inverts the default setting of that option.
enables the listing option
since it defaults off, while
disables the run time tests option
In additon to inverting the default settings of
options on the command line, it is also possible to control the
within the body of the program by using comments of a special
Here we see that the opening comment delimiter (which could also be a `(*')
is immediately followed by the character `$'.
After this `$', which signals the start of the option list,
we can place a sequence of letters and option controls, separated by `,'
\*(ddThis format was chosen because it is used by Pascal 6000-3.4.
In general the options common to both implementations are controlled
in the same way so that comment control in options is mostly
It is recommended, however, that only one control be put per comment for
maximum portability, as the Pascal 6000-3.4
implementation will ignore controls
after the first one which it does not recognize.
The most basic actions for options are to set them, thus
{$t-,p- No run-time tests, no post mortem analysis}
Notice that `+' always enables an option and `\-' always disables it,
no matter what the default is.
Thus `\-' has a different meaning in an option comment than it has on the
As shown in the examples,
normal comment text may follow the option list.
We now summarize the options of
These options may also be specified on the command line to
before the name of the file to be translated.
after the name of the file to be translated are passed to
the executed program run by
With each option we give its default setting,
the setting it would have if it appeared on the command line,
and a sample command using the option.
Most options are on/off valued,
taking a single digit value.
Buffering of the file output \- b
option controls the buffering of the file
The default is line buffering, with flushing at
each reference to the file
and under certain other circumstances detailed in section 5
on the command line, e.g.
% \*bpi -b assembler.p\fR
causes standard output to be block buffered,
where a block is 512 characters.
option may also be controlled in comments.
takes a single digit value rather than an on or off setting.
Any value 2 or greater causes block buffering and is equivalent
to the flag on the command line.
The option control comment setting
Include file listing \- i
names and causes these portions of the
program to be listed while translating\*(dg.
\*(dg\*bInclude\fR files are discussed in section 5.9.
flag up to the name of the file being translated,
which ends in `.p', are in this list.
% \*bpix -i scanner.i compiler.p\fR
to make a listing of the routines in the file scanner.i, and
% \*bpix -i scanner compiler.p\fR
to make a listing of only the routine
This option is especially useful for conservation-minded programmers making
partial program listings.
option enables a listing of the program.
When specified on the command line, it causes
a header line identifying the version of the translator in use
and a line giving the modification time of the file being translated
to appear before the actual program listing.
option is pushed and popped by the
option at appropriate points in the program.
Eject new pages for include files \- n
to eject a new page in the listing and print a header line at
file boundaries, providing automatic pagination control.
To have effect, either the
option should also be specified,
or the input should contain listing control in comments.
% \*bpi -in scan.i c.p\fR
and causes the runtime system to initiate a post-mortem
backtrace when an error occurs.
to count statements in the executing program,
enforcing a statement limit to prevent infinite loops.
on the command line disables these checks and the ability
to give this post-mortem analysis.
It does make smaller and faster programs, however.
It is also possible to control the
To prevent the post-mortem backtrace on error,
must be off at the end of the
Thus, the Pascal cross-reference program was translated with
Standard Pascal only \- s
option causes many of the features of the
implementation which are not found in standard Pascal
to be diagnosed as `s' warning errors.
This option defaults off and is enabled when mentioned on the command line.
Some of the features which are diagnosed are:
and the padding of constant strings with blanks.
In addition, all letters are mapped to lower case except in
strings and characters so that the case of keywords and identifiers
option is most useful when a program is to be transported, thus
option controls the generation of tests that subrange variable
values are within bounds at run time.
By default these tests are generated.
option is specified on the command line,
or in a comment which turns it off,
then the tests are not generated.
Thus the first line of a program to run without tests might be
Disabling runtime tests also causes
statements to be treated as comments.\*(dg
\*(dgSee section A.1 for a description of
Card image, 72 column input \- u
option on, either on the command line
or in a comment causes the input to be treated as
card images with sequence numbers and truncated to 72 columns.
Suppress warning diagnostics \- w
option, which defaults on,
allows the translator to print a number of warnings about inconsistencies
it finds in the input program.
Turning this option off with a comment of the form
suppresses these usually useful diagnostics.
Generate counters for an execution profile \- z
option, which defaults off,
enables the production of execution profiles.
on the command line, i.e.
or by enabling it in a comment before the
to insert operations in the interpreter code to
count the number of times each statement was executed.
was given in section 2.6;
its options are described in section 5.5.
is the name of the file containing the program to be interpreted.
If no arguments are given, then the file
If more arguments are given, they are available to the Pascal
program by using the built-ins
as described in section 4.6.
may also be invoked automatically.
In this case, whenever a Pascal object file name is given as a command,
the command will be executed with
will be converted to read
takes, on its command line, a list of options followed by the program file
name, which must end in `.p' as it must for
will produce an execution profile if any of the
options are specified on the command line.
If none of these options are specified, then
functions as a program reformatter.
See section 5.5 for more details.
It is important to note that only the
options, which are common to
can be controlled in comments.
All other options must be specified on the command line to have any effect.
The following options are relevant to profiling with
Include the bodies of all routines in the profile \- a
normally suppresses printing the bodies of routines
which were never executed, to make the profile more compact.
This option forces all routine bodies to be printed.
Extract profile data from the file core \- c
to extract the data from the file
in the current directory.
This is used in debugging the Pascal system, and should not
When an abnormal termination occurs in
it writes the data to the file
option enables profiling with data from this file.
Suppress declaration parts from a profile \- d
Normally a profile includes declaration parts.
on the command line suppresses declaration parts.
Eliminate include directives \- e
directives to the output when reformatting a program,
as though they were comments.
causes the contents of the specified files to be reformatted
into the output stream instead.
This is an easy way to eliminate
directives, e.g. before transporting a program.
Fully parenthesize expressions \- f
prints expressions with the minimal parenthesization necessary to
preserve the structure of the input.
to fully parenthesize expressions.
Thus the statement which prints as
with minimal parenthesization, the default, will print as
option specified on the command line.
Left justify all procedures and functions \- j
body is indented to reflect its static nesting depth.
This option prevents this nesting and can be used if the indented
output would be too wide.
Print a table summarizing procedure and function calls \- t
to print a table summarizing the number of calls to each
It may be specified in combination with the
Enable and control the profile \- z
profile option is very similar to the
listing control option of
is specified on the command line, then all arguments up to the
source file argument which ends in `.p' are taken to be the names of
files which are to be profiled.
If this list is null, then the whole file is to be profiled.
A typical command for extracting a profile of part of a large program
% \*bpxp -z test parser.i compiler.p\fR
This specifies that profiles of the routines in the file
Formatting programs using pxp
can be used to reformat programs, by using a command of the form
% \*bpxp dirty.p > clean.p\fR
Note that since the shell creates the output file `clean.p' before
executes, so `clean.p' and `dirty.p' must not be the same file.
automatically paragraphs the program, performing housekeeping
chores such as comment alignment, and
treating blank lines, lines containing exactly one blank
and lines containing only a form-feed character as though they
were comments, preserving their vertical spacing effect in the output.
distinguishes between four kinds of comments:
Left marginal comments, which begin in the first column of the
input line and are placed in the first column of an output line.
Aligned comments, which are preceded by no input tokens on the
These are aligned in the output with the running program text.
Trailing comments, which are preceded in the input line by a token with
no more than two spaces separating the token from the comment.
Right marginal comments, which are preceded in the input line
by a token from which they are separated by at least three spaces or a tab.
These are aligned down the right margin of the output,
currently to the first tab stop after the 40th column from the current
Consider the following program.
the following output is produced.
The following formatting related options are currently available in
described in the previous section may also be of interest.
to remove all comments from the input text.
A command line argument of the form
to underline all keywords in the output for enhanced readability.
Specify indenting unit \- [23456789]
uses to indent a structure statement level is 4 spaces.
By giving an argument of the form
spaces are to be used per level instead.
system printer driver does not implement
does not output a character `1'
in column 1 of a line, but rather puts out a form-feed
For those who wish to use carriage control, the filter
is available which interprets this control.
% \*bpix prog.p | pcc | lpr\fR
is fully described by its manual documentation
The cross-reference program
may be used to make cross-referenced listings of Pascal
To produce a cross-reference of the program in the file
one can execute the command:
The cross-reference is, unfortunately, not block structured.
are given in its manual section
A version of Wirth's subset Pascal translator
It was translated to interpreter code by
and is invoked by a command of the form:
The program in the file given is translated to interpretive code
which is then immediately executed.
Only small programs can be handled.
is most interesting to those wishing to study its error recovery techniques,
which are described in Wirth's book
.I "Algorithms + Data Structures = Programs" .
A text inclusion facility is available with
This facility allows the interpolation of source text from other
files into the source stream of the translator.
It can be used to divide large programs into more manageable pieces
for ease in editing, listing, and maintenance.
facility is based on that of the
To trigger it you can place the character `#' in the first portion of
a line and then, after an arbitrary number of blanks or tabs,
followed by a filename enclosed in single `\(aa' or double `"' quotation
The file name may be followed by a semicolon `;' if you wish to treat
this as a pseudo-Pascal statement.
The filenames of included files must end in `.i'.
An example of the use of included files in a main program would be:
\*bprogram\fR compiler(input, output, obj);
#\*binclude\fR "globals.i"
#\*binclude\fR "scanner.i"
#\*binclude\fR "parser.i"
#\*binclude\fR "semantics.i"
pseudo-statement is encountered in the input, the lines from
the included file are interpolated into the input stream.
For the purposes of translate- and run-time diagnostics and
statement numbers in the listings and post-mortem backtraces,
the lines in the included file are numbered from 1.
Nested includes are possible up to 10 deep.
See the descriptions of the
these can be used to control listing when
control lines are never printed in a listing.
option is not set, they are replaced by a line containing
the file name and a `:' character.
This is the default setting.
new page option is enabled then the
line is replaced with a banner line similar to the first line
This line is placed on a new page in the listing.
When a non-trivial line is encountered in the source text after an
`popped' filename is printed, in the same manner as above.
For the purposes of error diagnostics when not making a listing, the filename
will be printed before each diagnostic if the current
filename has changed since the last