Path: csiph.com!xmission!usenet.csail.mit.edu!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Rock Brentwood Newsgroups: comp.compilers Subject: Re: Bootstrapping yacc in yacc -> Bootstrapping yacc in lex! Date: Sun, 4 Apr 2021 13:27:53 -0500 Organization: Compilers Central Lines: 17 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <21-04-001@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="61278"; mail-complaints-to="abuse@iecc.com" Keywords: yacc, question Posted-Date: 04 Apr 2021 14:43:37 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:2641 From Kaz Kylheku: >You could simply allow rules of this form > ":" right side ... >With a semantic restrction that this must be preceded by a rule that >is not terminated with a semicolon, whose last element is a symbol: In other words: post-processing. That's not too much different that the id + colon hack. I misspoke in my earlier post. The hack was not created by Bison, but has been around and *is* part of the grammar in the POSIX standard. So the yacc grammar in the POSIX standard is LALR(1). I also see the hack done in the Sun version of UNIX hack. [I believe that hack goes way back. It always seemed to me ironic that the grammar for yacc, the most popular LALR(1) parser generator, isn't quite LALR(1). The original Unix yacc used the id+colon hack in C code. -John]