Path: csiph.com!news.swapon.de!goblin2!goblin3!goblin.stu.neva.ru!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: gah4 Newsgroups: comp.compilers Subject: Re: About finding the start symbol of a grammar Date: Sat, 22 May 2021 13:17:25 -0700 (PDT) Organization: Compilers Central Lines: 31 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <21-05-021@comp.compilers> References: <21-05-020@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="83623"; mail-complaints-to="abuse@iecc.com" Keywords: parse, comment Posted-Date: 27 May 2021 10:40:19 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com In-Reply-To: <21-05-020@comp.compilers> Xref: csiph.com comp.compilers:2672 On Saturday, May 22, 2021 at 10:24:24 AM UTC-7, Christopher F Clark wrote: > As Dodi noted, this is basically a graph analysis problem and the > graph may be disconnected (a forest). And our moderator has added > several insightful comments. E.g. you can "declare" a start symbol > and if not present default to some symbol, either the first one in the > grammar, or some symbol from which all other symbols are reachable > (presuming the graph isn't disconnected), and the start symbol can be > recursively defined, etc. Seems to me that this should be related to the problem of finding the root of a phylogenetic tree. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7149615/ Unlike CS trees, there is no necessary directionality to the links, and so finding the root is more difficult. Yet biologists have some desire to know where the root is. But as also noted above, in the case of recursion, it depends on the language. In most languages, is recursive, allowing for '(' ')' however, a language (though I don't know of any) could require all expressions to be parenthesized, in which case the start would be the parenthesized form. [I think previous messagees have made it clear that while this is an interesting exercise, its only practical use is to see if the start symbol declared in the grammar is different from the computed one, in which case the grammar is broken. -John]