Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: "Ev. Drikos" Newsgroups: comp.compilers Subject: Re: Improved accuracy in diagnostics. Is it worthwhile? Date: Sat, 19 Mar 2022 19:58:19 +0200 Organization: Aioe.org NNTP Server Lines: 35 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <22-03-041@comp.compilers> References: <22-03-035@comp.compilers> <22-03-038@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="94916"; mail-complaints-to="abuse@iecc.com" Keywords: parse, performance Posted-Date: 19 Mar 2022 13:59:18 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Content-Language: en-US Xref: csiph.com comp.compilers:2943 On 18/03/2022 20:12, Thomas Koenig wrote: > ... > If you are compiling, it is usually a small fraction of time that > is spent in the parsing, and much more in optimization and code > generation. An example: Compiling a 50 k line Fortran program with > "gfortran -O2" takes 17.4 seconds on the computer I type this on. > Checking with "gfortran -fsyntax-only" takes 4.2 seconds. (For > those who want to reproduce: aermod.f90 from the Polyhedron suite). > ... Thanks. Just tested this large file and the runtime overhead seems to be negligible. Likely, I'll try the change but it took me a while to find another case with enumerators (that also lack error recovery now). Although my trial changes added messages for 43 states, some of them are useless and so this approach seems to be useful for BNF rules with an optional tail. Unavoidably, a parser/front-end has to make some guessing on error and this doesn't change easily. So, any improvement without default state reductions (hello Kaz) will be limited, as in the code below: ----------------------------------------------------------------------- miniserver:errors suser$ cat enum-1.f90 && fcheck enum-1.f90 ENUM, BIND(C) ENUMERATOR :: RED => 4, BLUE => 9 ENUMERATOR YELLOW END ENUM END enum-1.f90:2: error: syntax:Unexpected: '=>'. Expected: ",", ";", or "=". Parsed with Errors: enum-1.f90 miniserver:errors suser$