Nicholas Clark <[EMAIL PROTECTED]> writes: > On Fri, Sep 06, 2002 at 02:20:10PM +0100, Piers Cawley wrote: >> Nicholas Clark <[EMAIL PROTECTED]> writes: >> >> > On Wed, Sep 04, 2002 at 10:46:24PM -0400, Ken Fox wrote: >> >> What is really needed is something that converts the date syntax >> >> to normal Perl code: >> >> >> >> rule iso_date { (<Perl.term>) - >> >> (<Perl.term>) - >> >> (<Perl.term>) >> >> { use grammar Perl::AbstractSyntax; >> >> $0 := (expr (invoke 'new (class 'Date) $1 $2 $3))) } >> > >> > I'm confused. Why has that last line got a lisp expression for the spliced >> > in code? >> >> 'cos S expressions are a relatively simple way of writing a syntax tree? > > But it's in the middle of stream of perl. > > Except, if I understand things correctly, the way the perl parsing rules > work, it would be quite legal for any perl grammar to say that the next > argument is to be written as an S expression *directly and raw in the source > code*, and the parser will happily then read one S expression to its > terminator, before continuing in perl (well, more conventional perl) syntax. > > ie Ken's code, above, could well be completely legal perl6 code. > > This idea of just switching language syntax in a context-sensitive way is > trying to make my head explode.
But you mean that in a good way right? Anyway, he did introduce the 'use grammar Perl::AbstractSyntax;' in the lexical scope, so obviously there's *something* afoot... -- Piers "It is a truth universally acknowledged that a language in possession of a rich syntax must be in need of a rewrite." -- Jane Austen?