Re: Van Wijngaarden grammars

Charles Lindsey <chl@cs.man.ac.uk>
7 Aug 91 08:56:23 GMT

          From comp.compilers

Related articles
Van Wijngaarden grammars tjj@thumper.bellcore.com (1991-07-22)
Re: van Wijngaarden grammars eggert@twinsun.com (1991-07-25)
Re: Van Wijngaarden grammars dww@math.fu-berlin.de (1991-07-25)
Re: Van Wijngaarden grammars tjj@thumper.bellcore.com (1991-07-29)
Re: Van Wijngaarden grammars hugh@cs.kun.nl (1991-08-02)
Van Wijngaarden grammars bevan@computer-science.manchester.ac.uk (Stephen J Bevan) (1991-08-02)
Re: Van Wijngaarden grammars chl@cs.man.ac.uk (Charles Lindsey) (1991-08-07)
Van Wijngaarden grammars fanf2@thor.cam.ac.uk (1996-02-24)
Re: Van Wijngaarden grammars solution@gate.net (1996-02-26)
Re: Van Wijngaarden grammars mparks@oz.net (Michael Parkes) (1996-02-27)
Re: Van Wijngaarden grammars dave@occl-cam.demon.co.uk (Dave Lloyd) (1996-02-27)
Van Wijngaarden grammars dave@occl-cam.demon.co.uk (Dave Lloyd) (1996-02-27)
Re: Van Wijngaarden grammars gvcormac@undergrad.math.uwaterloo.ca (Gordon V. Cormack) (1996-03-01)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Charles Lindsey <chl@cs.man.ac.uk>
Keywords: parse
Organization: Dept. Of Comp Sci, Univ. of Manchester, UK.
References: 91-07-047 91-08-005 91-08-013
Date: 7 Aug 91 08:56:23 GMT

In 91-08-013 bevan@computer-science.manchester.ac.uk (Stephen J Bevan) writes:


>My question is :-


>Are (Extended) Affix Grammars considered to be equivalent to van Wijngaarden
>grammars?


Roughly speaking, the difference between a pure W-Grammar and an Affix
Grammar is the same as the difference between an untyped language and a
strongly typed one. W-Grammars are very dangerous unless used with great
care, and they are in general unparseable (if you use all the nasty tricks
that are theoretically possible - of course we never did any such thing in
the ALGOL 68 Report :-) ).


Here is an example out of the original ALGOL 68 Report.


one out of LMOODSETY MOOD RMOODSETY mode FORM : MOOD FORM; ... .


Now the metagrammar can metaproduce 'real integral boolean' out of
'LMOODSETY MOOD RMOODSETY' in many ways (e.g. 'LMOODSETY' = 'real integral',
'MOOD' = 'boolean', 'RMOODSETY' = 'EMPTY'). Thus the 'MOOD' can be made to
correspond to any one of 'real', 'integral' or 'boolean', which is of course
the whole purpose of that rule.


But you could not do the same thing in an Affix Grammar (or in Prolog, which
is actually very similar to an Affix Grammar). And you would have the
greatest difficulty writing a parser that could use the rule in the form I
gave it.
--


Post a followup to this message

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