comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <eachus@mitre.org>
Subject: Re: Ayacc/Aflex "entropy" (P2Ada)
Date: 1999/10/29
Date: 1999-10-29T16:25:49+00:00	[thread overview]
Message-ID: <3819CBDA.E801A064@mitre.org> (raw)
In-Reply-To: 7v5ns8$2h1$1@nnrp1.deja.com



Robert Dewar wrote:
> 
  
> I think the parsing algorithm is less of an issue than error
> recovery,...

   Ageed.

> ...the error recovery of YACC is pathetic.

   Worse than that.  Since YACC does not even correctly implement
LALR(1),
you sometimes have to work hard to get it to compile correct programs.

> It is
> surprising what can be done with automatic generators in
> this area. See some of the papers from Fisher and Charles from
> the early days of the NYU Ada/Ed project.

  Yep, very good, and as you may remember Pat Prange and I extended LALR
on Multics in this direction.

> Many commercial Ada/83
> compilers made use of this work, and the syntactic error
> recovery of Ada/Ed was really quite good (not as good as GNAT,
> but GNAT has a lot of careful hand coded heuristic stuff that
> I doubt any automatic system could fully match).
 
   Agreed.  Again when using LALR, the automatic error messages and
error recovery was acceptable, but adding just a few 'extra' productions
to the grammar can (and did) vastly improve error diagnosis.  In fact,
one of the hardest problems of generating meaningful error messages is
knowing what the user intended to do, or for that matter what users do
wrong.  One of the biggest advantages of the Open Source approach is
that it is easier to get feedback on unacceptable error diagnostics. 
For example:

   ...
   package body Foobar is
   ...
   procedure Foo(X: in out Bar);
     I: Integer :=3;
   begin ...

   Is syntactically correct in Ada, but cannot be correct semantically.
However there is no semantic rule that says it is illegal either. 
Putting in a special case rule to recognize that the semicolon should be
an "is" helps a lot, but you also want to look further to deliver the
right error message.  This error commonly happens when someone uses the
package specification as a template for creating the package body.  But
does that begin belong to Foo or Foobar?  Looking at the package 
specification helps, but you really need to look ahead to see the "end"
that matches it.  (And of course insert a dummy body or change the
semicolon to "is" as appropriate.)

-- 

                                        Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...




  parent reply	other threads:[~1999-10-29  0:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-10-24  0:00 Ayacc/Aflex "entropy" (P2Ada) Gautier
1999-10-25  0:00 ` Ted Dennison
1999-10-25  0:00 ` Ray Blaak
1999-10-25  0:00   ` Gautier
1999-10-25  0:00 ` Ted Dennison
1999-10-26  0:00   ` Robert Dewar
1999-10-26  0:00     ` bourguet
1999-10-26  0:00       ` Robert I. Eachus
1999-10-27  0:00         ` Robert Dewar
1999-10-27  0:00           ` bourguet
1999-10-27  0:00           ` Ted Dennison
1999-10-29  0:00           ` Robert I. Eachus [this message]
1999-10-31  0:00             ` Robert Dewar
1999-11-01  0:00               ` Robert I. Eachus
1999-10-26  0:00       ` Ted Dennison
1999-10-26  0:00         ` William B. Clodius
1999-10-26  0:00     ` David Starner
1999-10-26  0:00       ` Robert Dewar
1999-10-30  0:00         ` Brian Rogoff
1999-10-31  0:00           ` Robert Dewar
1999-10-26  0:00     ` Gautier
1999-10-27  0:00       ` Tarjei Jensen
1999-10-27  0:00         ` David Botton
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox