Re: Looking for new language features

hannah@mamba.pond.sub.org (Hannah Schroeter)
22 Oct 2000 01:20:10 -0400

          From comp.compilers

Related articles
[11 earlier articles]
Re: Looking for new language features georg.lokowandt@sap.com (Georg Lokowandt) (2000-09-23)
Re: Looking for new language features vbdis@aol.com (2000-09-28)
Re: Looking for new language features rhyde@cs.ucr.edu (Randall Hyde) (2000-10-01)
Re: Looking for new language features idbaxter@semdesigns.com (Ira D. Baxter) (2000-10-06)
Re: Looking for new language features mr@peakSPAMLESSfive.com (Matt) (2000-10-06)
Re: Looking for new language features dsl@tepkom.ru (Dmitri Lomov) (2000-10-08)
Re: Looking for new language features hannah@mamba.pond.sub.org (2000-10-22)
| List of all articles for this month |

From: hannah@mamba.pond.sub.org (Hannah Schroeter)
Newsgroups: comp.compilers
Date: 22 Oct 2000 01:20:10 -0400
Organization: Chaos
References: 00-09-165 00-09-189 00-10-008 00-10-028
Keywords: design

Hello!


Ira D. Baxter <idbaxter@semdesigns.com> wrote:


>[...]


>Microsoft's "Intentional Programming" research tool is intended to be
>exactly such a beast. An "intention" is an extension to the base
>language, that is mapped to the base language by "user-defined"
>transformation rules ("reduction rules"). IP avoids "adding syntax
>rules" by adding "intention objects" instead, which I think of as
>simply new AST node types, and providing a direct-AST-manipulation
>editor for "easy entry" of such new node types. However, the language
>extending engineer still gets to provides "new information" (AST node
>type, editing rules, semantic checking rules, reduction rules, all
>these latter procedurally). And somehow, I don't see how you can
>avoid adding new information if you wish to have new constructs.


>[...]


>[Does anyone actually do syntax extension? If so, is it useful? -John]


The whole thing reminds me of two things that are IIRC actually done,
some even daily.


1. Lisp/Scheme macros
In Lisp and Scheme, the question is of course what you consider syntax
and what you consider (static) semantics. You can go one way and say
syntax is that there are atoms and there are lists ('(' sexp* ')').
In that view, normal macros do *not* extend the syntax. However,
reader macros in (non-Scheme IIRC) Lisp do. There are some reader macros
to parse infix syntax, such as in #I(1 + 2 * a). I'd guess they are seldom
used by normal Lisp programmers, however, in some mathematical code,
I believe such a syntax extension could be fine.


The other view is that you consider everything except normal function
application as special syntax. In that case, even normal macros can
be considered a syntax extension. One example (it's in the standard
and thus usable from every compliant implementation):
(loop for i from 1 to 10
            collect i into number-list
            sum i into number-sum
            finally return (values number-list number-sum))


2. camlp4
That's a preprocessor for objective caml. It has a definable input syntax
with transformation rules to produce vanilla ocaml code.


Kind regards,


Hannah.


Post a followup to this message

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