Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Thomas Koenig Newsgroups: comp.compilers Subject: Re: Improved accuracy in diagnostics. Is it worthwhile? Date: Fri, 18 Mar 2022 18:12:15 -0000 (UTC) Organization: news.netcologne.de Lines: 36 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <22-03-038@comp.compilers> References: <22-03-035@comp.compilers> Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="46601"; mail-complaints-to="abuse@iecc.com" Keywords: errors, design, comment Posted-Date: 18 Mar 2022 14:24:30 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:2940 Ev. Drikos schrieb: > This is mainly a parsing question but it's also Fortran related as well. [...] > So far, my approach has been that improved diagnostics shouldn't slow > down the processing of correct programs. With today's computer speeds, this is likely not a very important consideration any more. 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). 50k lines for a single source files is already quite a lot (much longer than most source files for modular programs are likely to be) and throwing a bit more CPU time at the problem to reduce user confusion by emitting better error messages is extremely likely to be a win for the user. Just be careful to avoid anything worse than O(n log n) for code size, or somebody will come along with a test case that takes _really_ long. (Take the above with a grain of salt for C++ headers.) > Is it worthwhile to improve > diagnostics by disabling default actions in a LALR parser? I would presume so. Run a few benchmarks and find out. [In my experience, lexing and optimization take most of the time, and parsing is insignificant. -John]