|Syntax directed compilation firstname.lastname@example.org (Barry Kelly) (2007-05-26)|
|Re: Syntax directed compilation email@example.com (Aaron Gray) (2007-05-28)|
|Re: Syntax directed compilation firstname.lastname@example.org (Steven Nichols) (2007-05-28)|
|Re: Syntax directed compilation email@example.com (2007-05-29)|
|Re: Syntax directed compilation cfc@shell01.TheWorld.com (Chris F Clark) (2007-05-29)|
|Re: Syntax directed compilation firstname.lastname@example.org (Matthew X. Economou) (2007-05-31)|
|Re: Syntax directed compilation email@example.com (Barry Kelly) (2007-06-20)|
|From:||Barry Kelly <firstname.lastname@example.org>|
|Date:||Sat, 26 May 2007 12:45:38 +0100|
|Posted-Date:||27 May 2007 15:17:43 EDT|
I recall, a long time back on this group, people pointing out that
languages supporting redefinable or user extensible grammars have
never taken off, and that like heavy armour on insects, it's a feature
more notable of the extinct than the extant. The argument against them
seems to be "too much power, users write their own languages and then
can't understand one another's". That always seemed like a weak
argument to me, and in this day and age of DSLs and indirect program
rewriting in dynamic languages, I wonder if it just hasn't been done
I've recently taken to thinking of source code as being a program to
produce an executable, where compilers are interpreters of the text.
That is, a declaration like 'int x;' in a C-like language is an
imperative statement in the compiler's language to 'declare a variable
called "x", of type "int", and add it to the current scope'.
In this view, it is quite noticeable that most languages don't support
much abstraction during this compile-time interpretation. C++
templates seem like a limited and clumsy form of functions over parse
trees, while C#/.NET-style type generics are single-level type
constructors, and method generics method constructors. C macros are a
very crude manipulation of the source text, with almost no syntax or
type awareness. But this is all small stuff compared to the adventures
of Ruby and its ilk.
As far as I can see, the closest living embodiment of the concept is
Lisp, but Lisp programs seem not to have explored this particular
level of abstraction - viewing the source read by the Lisp interpreter
/ compiler as being instructions on how to create an
executable. Instead, while much macro magic is available, ultimately
it only affects the code subsequently read, rather than defining the
back-end of a compiler.
To old fogies of 27 like me, who like statically verified type safety,
one of the major advantages of the approach I'm describing is that it
enables both (a) Lisp-level abstraction, symbolic manipulation and
program rewriting and (b) compile-time type safety with a classically
efficient target executable. It brings the dynamic touch to the static
world. It also moves much, if not most, of the body of the compiler into
the run-time library of the language.
Has there been research in this area that I've missed on my searches
(using 'syntax directed compilation' as my main phrase)?
Is the idea trivially dismissible by some argument I'm not aware of?
Or is the idea completely bonkers, and am I clearly advertising my
insanity by outlining it?
[IMP72 let you extend the syntax either as macros or by writing calls
to the back end code generator. In practice it had all of the same
problems of write-only code as other extensible languages. -John]
Return to the
Search the comp.compilers archives again.