Re: The STEP Preprocessor

glen herrmannsfeldt <gah@ugcs.caltech.edu>
Tue, 2 Aug 2011 20:54:27 +0000 (UTC)

          From comp.compilers

Related articles
The STEP Preprocessor gah@ugcs.caltech.edu (glen herrmannsfeldt) (2011-07-12)
Re: The STEP Preprocessor prenom_nomus@yahoo.com (Marco) (2011-07-16)
Re: The STEP Preprocessor gah@ugcs.caltech.edu (glen herrmannsfeldt) (2011-08-02)
| List of all articles for this month |

From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: Tue, 2 Aug 2011 20:54:27 +0000 (UTC)
Organization: Aioe.org NNTP Server
References: 11-07-020 11-07-025
Keywords: macros, history
Posted-Date: 04 Aug 2011 11:35:26 EDT

Marco <prenom_nomus@yahoo.com> wrote:
> This was a fairly popular technique back in the 1970s.
> The RATFOR preprocessor <http://en.wikipedia.org/wiki/Ratfor>
> was actually used by non-academic types.


> [Considering that Ratfor was written at Bell Labs, of course it
> was used by non-academic types. It was quite popular in the
> numerical analysis community. I ported it to PDP-10 Fortran. -John]


STEP was written at the same place as MORTRAN, and, as I understand
it, is meant to be a little higher level. (Maybe a step up, I don't
know the source of the name.)


MORTRAN and RATFOR are similar in being macro processors for an
improvement to Fortran. Both have the limitation that bad input
can generate bad output, with the error messages uncoupled to
the original error. STEP allows the macro writer to restrict
the allowed arguments to a macro, and generate error messages
as appropriate.


The example in the manual starts with a macro allowing for:


      ADD A TO B AND STORE INTO C;


(In the days when programming was done in upper case.)


If instead one wrote:


      ADD A TO B AND STORE INTO 38;


A processor like RATFOR or MORTRAN would generate Fortran
code that would generate an error from the Fortran compiler.


With STEP, one can write a macro that restricts the argument
appropriately, and generates an error message when appropriate.
The message can accurately describe the problem in terms of
the original source statements.


The MORTRAN (and I believe RATFOR) processors were designed to
minimize the required storage, such that large programs could be
processed even on machines without a lot of memory. Doing the
full parse with STEP likely does take more memory. With current
machines, that is not likely to be a problem.


-- glen
[The people who did Ratfor did a subsequent language called EFL that
was a full compiler that translated into Fortran. As was clear if you
looked at the yacc source, Ratfor didn't know any Fortran, and just
passed through anything it didn't know how to handle. Nonetheless, it
worked pretty well, particularly if you could pass through hints to
the Fortran compiler about what line numbers in the Ratfor source
corresponded to what lines in the Fortran. -John]





Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.