[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Syntax extension of infix languages



On Sat, 2001-12-15 at 20:27, Tim Hickey wrote:
> Prolog uses an extensible infix grammar based on an extension of
> operator grammars. A program can introduce new infix operators with
> specified associativity, precedence, and fixity (infix, prefix, postfix).
> The parser always translates the expressions into operator syntax
> trees in a fairly simple manner.
> 
> Has anyone tried using a Prolog style syntax for Scheme? It might
> provide an interesting (and easy to use) "skin" for Scheme.

Let me clarify--

I'm interested in syntax extension that's powerful enough to add new
statements and declarations to the language.  A simple example might be
an 'unless' statement in Dylan:

 define macro unless
   { unless (?:expression) ?:body end }
     => { if (~?expression) ?body end }
 end macro unless;

A more complicated example might be implementing 'lex' or 'yacc' as a
compile-time macro.

This is a much more annoying problem than defining new operators.

Cheers,
Eric