[comp.lang.misc] Grammars

piet@ruuinf.UUCP (Piet van Oostrum) (04/25/88)

Posting-Front-End: GNU Emacs 18.47.9 of Mon Mar 21 1988 on ruuinf (hcx/ux)


In article <11532@shemp.CS.UCLA.EDU> gast@lanai.cs.ucla.edu (David Gast) writes:
   2) There are other grammar formalisms besides CFGs.  For example, vW
      or two level grammars.  While the typical reader may not want to
      read a vW grammar, the language could be defined with a vW grammar
      so that compiler writers could check their compilers.  The user
      could be told about indentation.

      It might also be possible, to use the Grammar Rule Notation, a la
      Prolog to describe the indentation levels.  I do not know (because
      I have not really considered it). The GNR is more powerful than
      a CFG.  An extra argument to the grammar rules could indicate the
      level of indentation.

Currently I think Attribute Grammars (AG) are the most useful things in
grammar land. They are a little bit less powerful than vW grammars, but
rightly so, as vW grammars are generally not decidable (i.e. it is not
generally possible to automatically make a compiler from a vW grammar; for
some grammars there isn't even a parser possible). An AG takes just that
extra structure that makes it much more useful. It is very easy to write an
AG that takes declaration before use into account.

I haven't compared GNR with AG, so I don't know how they compare, but they
look a bit similar.

-- 
Piet van Oostrum, Dept of Computer Science, University of Utrecht
Budapestlaan 6, P.O. Box 80.012, 3508 TA Utrecht, The Netherlands
Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht (after May 11)
Telephone: +31-30-531806              UUCP: ...!mcvax!ruuinf!piet