Path: csiph.com!xmission!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: luser droog Newsgroups: comp.compilers Subject: Re: Supporting multiple input syntaxes Date: Thu, 13 Aug 2020 21:37:55 -0700 (PDT) Organization: Compilers Central Lines: 23 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <20-08-007@comp.compilers> References: <20-08-002@comp.compilers> <20-08-005@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="99998"; mail-complaints-to="abuse@iecc.com" Keywords: C, tools Posted-Date: 15 Aug 2020 10:45:04 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: <20-08-005@comp.compilers> Xref: csiph.com comp.compilers:2559 On Thursday, August 13, 2020 at 5:24:36 PM UTC-5, minf...@arcor.de wrote: > Am Donnerstag, 13. August 2020 00:32:56 UTC+2 schrieb luser droog: > > I've got my project successfully parsing the circa-1975 C syntax > > from that old manual. I'd like to add parsers for K&R1 and c90 > > syntaxes. > > > > How separate should these be? Should they be complete > > separate grammars, or more piecewise selection? ... > > Why not settle for one master dialect and use awk to translate between dialects? > > [Probably because there is a great deal of C code written to comply with > the various versions of the standard, users want error messages that match > the code they wrote rather than some intermediate code, and it would be quite > an awk program that could reconcile all the differences among C flavors. -John] One of the possible goals for this project is exactly such a translator that can downgrade or upgrade code from one standard version to another. Another possible application is a source code formatter. Currently the CST produced by the parser keeps all the original whitespace attached to each token.