Path: csiph.com!tncsrv06.tnetconsulting.net!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Eduardo Costa Newsgroups: comp.compilers Subject: About finding the start symbol of a grammar Date: Fri, 21 May 2021 03:49:43 -0700 (PDT) Organization: Compilers Central Lines: 28 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <21-05-015@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="65584"; mail-complaints-to="abuse@iecc.com" Keywords: parse, question, comment Posted-Date: 21 May 2021 09:46:22 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:2666 Hey guys, I've been lately dealing with a parser generator for LL grammars, and since it's inception I've always been blindy assuming the first element read from within the input file is going to be the start symbol or starting rule. So I've been wondering all this time, just out of curiosity, if there exists a method or algorithm to find out the start symbol of a given grammar? I guess the answer is no. While there would exist grammars we could recursively check to find out which it's start symbol is (i.e.: it's the only rule that used the rest of them, where checking every other resulted in dangling rules that weren't even called in), there might be other grammars for which more than one rule yields full coverage (all of these obviously defining different languages) and so leading to ambiguity. I only contemplate a simple coverage test, even though other techniques could exist, again, all of them leading to a point where we couldn't ascertain if one or the other is what the user meant. So I'm wondering if this is even an issue in production-grade parser-generators out there? Regards, [yacc and its descendants have an explicit %start declaration, usually defaulting to the first rule in the file. -John]