Index of /archives/text/CTAN/support/pp

Icon  Name                         Last modified      Size  Description
[PARENTDIR] Parent Directory - [   ] pas.res 1990-12-12 09:00 463 [   ] mod.res 1990-09-26 09:00 536 [TXT] README 1993-03-19 09:00 3.3K [   ] pp.mod 1994-02-16 09:00 19K [   ] pp.exe 1994-02-16 09:00 40K
README.

PP.MOD
PP.EXE
MOD.RES
PAS.RES

Author: Mike Piff <M.Piff@sheffield.ac.uk>


PP is a program that takes a free-standing Modula-2 or Pascal
program, and converts it into a Pretty-Printed \LaTeX/plain \TeX\ file
ready to input into your document. This is more attractive than
a verbatim listing.

Example of Usage
================

As an example, suppose we run PP on the file PP.MOD (with its header
removed), to produce PP.TEX---a file that is both a plain \TeX\ and
\LaTeX\ file:

PP
PP Copyright (C) 1992 by Mike Piff, 10/29/92 01:27pm
Input filename for reserved words
in> MOD.
Give input file: in> PP.MOD
Give output file: out> PP.TEX


Notes
=====

The source code is included in this distribution,
together with an MS-DOS executable.

As Modula-2 is case-sensitive, whereas Pascal is not,
it is necessary to inform the program which language is
being used. Two customization files MOD.RES and PAS.RES
are included. It is possible that customization files
can be built for other languages too---I haven't tried,
but please let me know if you produce any.

The current format of each customization file is

No. of keywords
optional * to indicate case-insensitive
list of keywords

The first thing the program does is prompt for the list of
keywords. After that it asks for an input file and an output
file, and that is it!

...almost. One problem with this kind of listing is that
\TeX\ has trouble breaking a program at a meaningful place,
eg, after declarations. Thus, we need to give it some clues.
A BLANK LINE in the input indicates a good breakpoint, but
DOES NOT result in blank lines in the output. However,
n>1 blank lines result in n-1 blank output lines. Thus,
space your program carefully!

Another problem is the way that Modula-2 and Pascal delimit
comments. Whereas Wirth used [ ] for sets in Pascal,
contrary to all mathematical practices, and { } or (* *)
for comments, in Modula-2 he
reserved { } for sets. Thus, the results will look better
if you use (* *) for comments in Pascal rather than
{ }. Maybe this could be added to the customization file,
but I haven't found the need yet.

To make your comments come out reasonable, assume that you
are in horizontal (text) mode inbetween (* and *). Thus,
write
(* and so $2^n\geq\log m$ *)
rather than
(* and so 2^n>= log m *)
If you want to include a bit of code inside a comment,
precede it and follow it by **. Thus
(* Or use
**
PROCEDURE xxx;FORWARD;
**
if yours is a single pass compiler *)

The output of PP is similar to that of WEB, say, but your
program is free-standing and you do not need to learn to
use WEB. Generally, horizontal spacing is respected in the
output, but you should use spaces rather than tabs for this
to work. I have used := rather than <- for assignments.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Dr M J Piff                      %%  e-mail:
%% Department of Pure Mathematics   %%
%% University of Sheffield          %%  M.Piff@sheffield.ac.uk
%% Hicks Building                   %%  PM1MJP@derwent.shef.ac.uk
%% Hounsfield Road                  %%  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SHEFFIELD S3 7RH                 %%  Telephone: (0742) 824431
%% England                          %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%