Re: Root rule

Since I frequently write grammars in which the start symbol can 
appear recursively, I think ’not used on any RHS’ is not a good way
to identify the start symbol.  Example:  here is one of the grammars 
I used in demos in my Declarative Amsterdam talk:

    S: S; ‘a’.

(I think this may have been the grammar that your ABC parser
was unhappy with, and if it’s looking for a rule that appears on no
RHS to use as the start symbol, I can understand why this grammar
might make it unhappy.)

Also, as John Lumley’s example of the other day shows, sometimes
people write collections of productions not all of which are reachable,
in which case there is more than one rule which appears on no
right-hand sides.

So I think that the start symbol should be identified in some other 
way.  Having a new piece of syntax to identify the start symbol would
work, but I have come to like the minimalism of having it just be the 
first nonterminal listed.

Michael

p.s. Speaking if your implementation - is your code publicly visible
anywhere?


> On 7,Nov2021, at 2:57 PM, Steven Pemberton <steven.pemberton@cwi.nl> wrote:
> 
> The spec currently says
>   "The root symbol of the grammar is the name of the first rule in the grammar. "
> 
> while my implementation instead identifies the single rule that is not used on any RHS.
> 
> Any opinions on the desirability of either approach?
> 
> Steven
> 

Received on Sunday, 7 November 2021 23:28:43 UTC