From: Paul.Klint@cwi.nl (Paul Klint)
Newsgroups: comp.compilers
Subject: Re: Online Bibliography for Macro Processors for HL languages sought.
Keywords: macros, bibliography, specification
Date: 28 Aug 92 14:32:05 GMT
Reply-To: Paul.Klint@cwi.nl (Paul Klint)
Organization: CWI, Amsterdam

daniel@dolores.stanford.edu (Daniel Weise) writes:
> I've been doing research on adding syntax macros to modern languages.
> ...
> PS. if anyone is working in this field (it's only been abandoned
> now for about 15 years!), I'd like to know of it.
>
> PPS. "Syntax Macros" are macros that run during parse time, and where
> the matching, substitutions, and manipulations are based on AST's, not
> on character strings.

Well Daniel, in a disguise you might not recognize at first sight, we have
been working on this topic over the last years. Instead of extending a
*programming* language with syntax definition facilities, we added syntax
definition facilities to a *specification* language (ASF) based on
conditional rewrite rules.

The rewite rules themselves are based on the matching and replacement of
abstract terms (= trees).  The syntactic extensions are obtained as
follows:
	(1) The desired syntax is defined. The definition formalism used
	    (SDF)---and its implementation---are based on general
	    context-free parsing and thus allows you to define an
	    arbitrary context-free grammar.
	(2) The mapping between concrete and abstract syntax is implicit,
	    i.e., there is a fixed correspondence between strings and
	    abstract syntax trees.

The resulting formalism (ASF+SDF) has the complete expressive power of
conditional rewrite rules with additional benefits of user-defined syntax.
We use it to define the formal syntax and semantics of "formal languages"
(e.g., programming and specification languages, application languages).

At the implementation level, we use lazy/incremental techniques for the
generation of scanners and parsers. In this way, ASF+SDF specifications
can be edited interactively while their corresponding implementation is
kept up-to-date.

You can find further information on this work in:

	J. A. Bergstra, J. Heering, and P. Klint (eds),
	Algebraic Specification,
	ACM Frontier Series, The ACM Press in cooperation with
	Addison-Wesley, 1989.
	(See in particular Chapters 6-9).

	J. Heering, P.R.H. Hendriks, P. Klint and J. Rekers,
	The syntax definition formalism SDF -- reference manual,
	SIGPLAN Notices 24(11):43-75, 1989.

	J. Heering, P. Klint and J. Rekers,
	Incremental generation of parsers,
	IEEE Transaction on software engineering 16(12):1344-1351,1990.

	J. Heering, P. Klint and J. Rekers,
	Incremental generation of lexical scanners,
	to appear in october issue of ACM TOPLAS, 1992.

	P. Klint,
	A meta-environment for generating programming environments,
	In J.A. Bergstra and L.M.G. Feijs (eds), Proceedings of the
	METEOR workshop on Methods Based on Formal Specification,
	Springer LNCS Vol. 490, 105-124, 1991.
	(Revised version submitted to ACM TOSEM)

	J. Rekers,
	Parser generation for interactive environments,
	PhD Thesis, University of Amsterdam, 1992.


Paul Klint
-- 
Send compilers articles to compilers@iecc.cambridge.ma.us or
{ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.