Re: extending a grammar (Pasquale Foggia)
21 Mar 1996 23:50:13 -0500

          From comp.compilers

Related articles
extending a grammar (1996-03-12)
Re: extending a grammar (1996-03-21)
Re: extending a grammar platon! (1996-03-25)
Re: extending a grammar (1996-03-27)
Re: extending a grammar (1996-03-27)
| List of all articles for this month |

From: (Pasquale Foggia)
Newsgroups: comp.compilers
Date: 21 Mar 1996 23:50:13 -0500
Organization: Compilers Central
References: 96-03-082
Keywords: parse, design

Mauk van der Laan wrote:
> { ... has anybody ever seen a language that allows grammar extension? ... }

As far as I know, there are at least two such languages still in use:

1) lisp, with defmacro, allows to rewrite an expression in an almost
      arbitrary way before its evaluation. This is made possible by
      the fact that lisp expressions have the same structure of data,
      and thus can be processed using other lisp expressions.
      The drawback is that, in order to preserve this property,
      new expression types created with defmacro cannot be too much
      different from the traditional ones (i.e., full-parenthesized
      prefix expressions).

2) Clipper 5.x has a powerful preprocessor that can be used to
      define new statements, though the rewrite rules are not so
      general as EBNF. This feature has been implemented to allow
      a soft transition from the old dBase III-like syntax of
      Clipper87 to the new C-like syntax of Clipper 5.0: almost all
      the old style statements are translated into function calls
      by a set of macros automatically loaded by the compiler.
      This mechanism is also used thoroughly to make various
      language extensions, like Object Oriented Programming.

I agree with our moderator that an extensive use of these features
can quickly lead to write-only programs.

Pasquale Foggia, PhD student | #include <disclaimer.h>
University of Naples "Federico II" | finger for
Naples, Italy | complete address, PGP key, geek code etc.

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.