MC Carthy, when creating Lisp, decided on an
abstract syntax that is fine and
dandy for people doing program rewriting but never provided
a human palatable concrete syntax. But normal people often don't
deal at that level. The constraints to clearly display programs are different than those to programmatically manipulate them.
On the other hand. Perl5 had never correctly tackled the problem of
program manipulation/transformation. Source filters are a ugly hack; eval-string should
be limited to deal with user output.
Dealing directly with B:: modules with the "object" level, hum, the
intricate plate of spaghetti generated whem compiling a Perl program is even worse.
At last, with Perl6, we will have macros in the sense of Lisp (abstract syntax level rewriting)
not in the sense of C (textual level rewriting, the C-preprocessor does not even know about C concrete syntax).
Macro combined with concrete syntax will be a way
to cast cleanly new programmatic patterns in the language.. Perl has always promoted growth and experimentation
but had never provided an appropriate mechanism.
To fully understand the power of macros in Perl6, one should read
Paul Graham's book
On Lisp while keeping in mind the stuff about
macros in the last apocalypse.
Perl6 macros will bridge the gap between abstract and concrete syntax. I have been told that it is not the first
to do it but if Perl6 becomes popular, it will bring that
power to general conciousness.
Note also that the distinction between concrete and abstract syntax parallels the distinction made by Chomsky between
surface and deep structures.
But some will claim that Chomsky is a fraud in linguistic. This has nothing to do with his political opinions :)
From modern compiler implementation in ML p 101:
The notion of abstract syntax is due to McCarthy (1963), who designed the abstract syntax for Lisp (McCarthy et al. 1962). The abstract syntax was intended to be used writring programs until designers could get around to create a concrete syntax with human readable punctuation (instead of Lots of Irritating Silly Parentheses), but programmers soon got used to programming directly in abstract syntax.
--
stefp
Come to YAPC::Europe 2003 in Paris, 23-25 July 2003. |