9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: bakul@bitblocks.com (Bakul Shah)
Subject: [9fans] all you yacc experts
Date: Sat, 12 Nov 2011 01:23:54 -0800	[thread overview]
Message-ID: <20111112092354.71E08B858@mail.bitblocks.com> (raw)
In-Reply-To: Your message of "Fri, 11 Nov 2011 12:54:28 PST." <20111111205428.22C00B856@mail.bitblocks.com>

On Fri, 11 Nov 2011 12:54:28 PST Bakul Shah <bakul at bitblocks.com>  wrote:
> On Fri, 11 Nov 2011 08:07:21 PST ron minnich <rminnich at gmail.com>  wrote:
> > If somebody wants to look at enhancing yacc so that the extra bison
> > bits can be supported, that would probably do the trick. I have no
> > idea of the level of effort, I have not looked.
> 
> After some googling I see that src/cmd/gc/bisonerrors was
> added by Russ in an evening to improve go error messages.
> 
> Clinton Jeffery in his "Generating LR syntax error messages
> from examples" paper (http://www.cs.nmsu.edu/~jeffery/merr.pdf
> -- not sure if this is the same paper as the one in TOPLAS)
> says his Merr program works with Berkeley yacc, AT&T yacc &
> bison.  He also refers to a modified byacc called iyacc.
> 
> Might it be worth looking Merr or iyacc?  Porting bison to
> plan9 seems like a hugh punishment for a quick hack:-)
> Implementing Jeffery's directly in yacc might benefit other
> parsers as well.

Reading Merr code was useful but it is written in Icon so....

After staring at go.y, bisonerrors, go.errors, bison's
y.output, and generated yerr.h for a while I think I
understand what is going on.  I believe everything needed is
already in plan9's y.output -- no need to change yacc.  It may
be easier to just make bisonerrors handle this than convert
plan9's y.output to bison compatible y.output.  Of course,
things may look much bleaker in the morning but this is what I
think now!

Given that an array of <state, terminal, message> is generated
from y.output & go.errors, it is may be worth integrating this
logic in yacc. But that is for another day.

Ideally something like go.errors is interactively generated
from actual errors (sort of like how a spellchecker works --
you are presented with an error + its context and you indicate
the error message &/or fix). This is then fed back to yacc
along with the grammar.



  parent reply	other threads:[~2011-11-12  9:23 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-11 16:07 ron minnich
2011-11-11 17:16 ` Steve Simon
2011-11-11 20:54 ` Bakul Shah
2011-11-11 20:58   ` ron minnich
2011-11-11 21:30     ` Bakul Shah
2011-11-11 23:18       ` Steve Simon
2011-11-12  4:51       ` Lucio De Re
2011-11-12  5:15         ` Bruce Ellis
2011-11-12  5:36           ` Lucio De Re
2011-11-12  4:49     ` Lucio De Re
2011-11-11 23:38   ` Iruatã Souza
2011-11-12  9:23   ` Bakul Shah [this message]
2011-11-13  0:53     ` Bruce Ellis
2011-11-13  4:48       ` Lucio De Re
2011-11-13  5:55         ` Bruce Ellis
2011-11-13 10:08         ` Steve Simon
2011-11-13 10:30           ` Bruce Ellis
2011-11-13 17:08             ` ron minnich
2011-11-15 21:10 ` Anthony Martin
2011-11-15 21:49   ` David Leimbach
     [not found] <CAP6exY+7R9z3uusW683gFCCjvt+t6cZVpq-0TWZL2SiDBbMw3g@mail.gmail.c>
2011-11-11 16:09 ` erik quanstrom
2011-11-11 17:27   ` Lucio De Re
2011-11-11 17:25     ` ron minnich
2011-11-11 18:00       ` Lucio De Re
     [not found] <CABT0RTRAXEL454dP+gpC7gYtV9hT7mk+1znEVU0NP4CuKcW=vg@mail.gmail.com>
2011-11-13 22:30 ` Scato Logic
2011-11-13 23:22   ` Bruce Ellis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111112092354.71E08B858@mail.bitblocks.com \
    --to=bakul@bitblocks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).