|[11 earlier articles]|
|Re: Looking for new language features email@example.com (Georg Lokowandt) (2000-09-23)|
|Re: Looking for new language features firstname.lastname@example.org (2000-09-28)|
|Re: Looking for new language features email@example.com (Randall Hyde) (2000-10-01)|
|Re: Looking for new language features firstname.lastname@example.org (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 email@example.com (Dmitri Lomov) (2000-10-08)|
|Re: Looking for new language features firstname.lastname@example.org (2000-10-22)|
|From:||email@example.com (Hannah Schroeter)|
|Date:||22 Oct 2000 01:20:10 -0400|
|References:||00-09-165 00-09-189 00-10-008 00-10-028|
Ira D. Baxter <firstname.lastname@example.org> 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))
That's a preprocessor for objective caml. It has a definable input syntax
with transformation rules to produce vanilla ocaml code.
Return to the
Search the comp.compilers archives again.