Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #2937

Improved accuracy in diagnostics. Is it worthwhile?

Path csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end
From "Ev. Drikos" <drikosev@gmail.com>
Newsgroups comp.compilers
Subject Improved accuracy in diagnostics. Is it worthwhile?
Date Fri, 18 Mar 2022 07:25:40 +0200
Organization Aioe.org NNTP Server
Lines 47
Sender news@iecc.com
Approved comp.compilers@iecc.com
Message-ID <22-03-035@comp.compilers> (permalink)
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="84428"; mail-complaints-to="abuse@iecc.com"
Keywords errors, question
Posted-Date 18 Mar 2022 12:28:46 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:2937

Show key headers only | View raw


Hello,

This is mainly a parsing question but it's also Fortran related as well.

When I make syntax checking with the command 'fcheck' in the code below,
the error message doesn't contain a '(' in the expected tokens. This
happens due to default actions, although the parser is basically LALR. A
pure LALR parser wouldn't make reductions without examininig the lookahead.

Default actions are useful because they save a lot of space in parsing
tables, at the cost of missing expected tokens in the error messages
printed by the command 'fcheck'. This is the relevant BNF rule for the
example given at the end of this message:

implicit-stmt ::=
   IMPLICIT implicit-spec-list
| IMPLICIT NONE [ ( [ implicit-none-spec-list ] ) ]


Disabling default actions for the command 'fcheck' is fairly simple,
just a button click in Syntaxis, but at the moment I can't think of
how many error messages would be improved, whereas a parsing table
increase (50%) would be granted. The command 'fcheck' can be found at
https://github.com/drikosev/Fortran

So far, my approach has been that improved diagnostics shouldn't slow
down the processing of correct programs. Is it worthwhile to improve
diagnostics by disabling default actions in a LALR parser?


Thanks,
Ev. Drikos

----------------------------------------------------------------------
$ cat default-actions.f90 && fcheck default-actions.f90
  IMPLICIT NONE ? (type, external)
  PRINT *, "Only ';', not a '(', in the expected tokens in diagnostics."
  END

default-actions.f90:1: error: syntax:Unexpected: '?'. Expected: ";".

Parsed with Errors: default-actions.f90
$
[When yacc was new and everything had to fit in 64K, small parse tables
were important.  Today when people include a megabyte library to get
a four line routine, not so much. -John]

Back to comp.compilers | Previous | NextNext in thread | Find similar


Thread

Improved accuracy in diagnostics. Is it worthwhile? "Ev. Drikos" <drikosev@gmail.com> - 2022-03-18 07:25 +0200
  Re: Improved accuracy in diagnostics. Is it worthwhile? Kaz Kylheku <480-992-1380@kylheku.com> - 2022-03-18 16:47 +0000
  Re: Improved accuracy in diagnostics. Is it worthwhile? Thomas Koenig <tkoenig@netcologne.de> - 2022-03-18 18:12 +0000
    Re: Improved accuracy in diagnostics. Is it worthwhile? "Ev. Drikos" <drikosev@gmail.com> - 2022-03-19 19:58 +0200

csiph-web