"John Lindsay" <>
28 Jun 1998 00:00:28 -0400

          From comp.compilers

Related articles
MACRO PROCESSOR (PAtrick COhen) (1998-06-27)
Re: MACRO PROCESSOR (John Lindsay) (1998-06-28)
Re: MACRO PROCESSOR (1998-06-28)
Re: MACRO PROCESSOR (and Re: writing an assembler!) (Phil Budne) (1998-07-01)
MACRO PROCESSOR (1998-07-01)
Re: MACRO PROCESSOR (1998-07-05)
Re: MACRO PROCESSOR (Sameer Nanajkar) (1998-07-08)
Re: MACRO PROCESSOR (Olaf Langmack) (1998-07-08)
| List of all articles for this month |

From: "John Lindsay" <>
Newsgroups: comp.compilers
Date: 28 Jun 1998 00:00:28 -0400
Organization: Royal Military College of Canada
References: 98-06-154
Keywords: assembler, macros, comment

PAtrick COhen wrote:
> I have to develop a macro processor for the macro used in
> assembly of IBM 370. You know the MACRO.. MEND block and the AIF, AGO
> and LCLA , SETA .....
> So I'm intersted to know if any one has an idea about the
> algorithm and where to find the algorithm (URL ?). I'm intersted if
> some one can give me too the name of a book that treat this subject
> with detail.


You have a very big job on your hands. It can mushroom into a huge
piece of code because of the open-code macro capabilities (using macro
capabilities outside of macros -- and some of this is subtly different
from the uses inside!). There are 2 major ways to go. The first is,
realizing that the 370 assembler and macro language is a language,
write a compiler for it may be written using compiler-compiler tools
like PCCTS (but the language is a _MESS_). Any of the
compiler-compiler books like the dragon book or the PCCTS book will
provide a start here. The second is ye olde ad hoc method, especially
if it is implemented in a language with a powerful string-processing
and data handling capability like SNOBOL 4 (get the Spitbol compiler
from Catspaw for any of a number of platforms, or one of a couple of
other SNOBOL systems) or Icon (surf to the U. of Arizona -- its free
and available for several platforms and systems!).

If this is a one-off job, the second way to go is almost certainly
better; in the general case there are many wierd things to take care
of, like the inconsistent interpretation of list and sublist macro
arguments, and if this is to be used apart from the 370 assemblers as
a standing utility, it may be necessary to go the first way.

Do note the PUNCH statement; it may be possible to do your macro
processing with a 370 assembler, and use the PUNCH output elsewhere.

As for algorithms, see if you can get a copy of the SPASM assembler;
it was (?is?) a student assembler done at Stanford Linear Accelerator
(sorry, I'm retiring and I just threw several listings and tapes out).
There was another assembler called Assist done at (????) University of
Pennsylvania, and its listings might be a help.

John H. Lindsay
Department of Mathematics and Computer Science

Phone: (613) 541-6000--1--6419
Fax: (613) 541-6584
[I agree. If you need Assembler H, you know where to find it. -John]

Post a followup to this message

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