9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Rudolf Sykora <rudolf.sykora@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] bison problem, not plan9 related
Date: Wed, 21 Oct 2009 21:41:17 +0200	[thread overview]
Message-ID: <a560a5d00910211241l6307cbe8m4bfe50e6b85f060d@mail.gmail.com> (raw)
In-Reply-To: <dd6fe68a0910211147n56655babse510d8fc02112582@mail.gmail.com>

2009/10/21 Russ Cox <rsc@swtch.com>:
> To know how to decide, yacc needs a precedence
> for the thing being shifted and the rule.  You've
> given precedences for each rule (REP block has
> REP's precedence, and block block has +'s thanks
> to the override) but not to ATOM.
>
> Concretely, when yacc sees REP block ATOM
> it isn't sure whether that's (REP block) ATOM or
> REP (block ATOM).
>
> Instead of
>
>> %token  ATOM
>> %left   '+'
>> %left   REP
>
> you probably want
>
> %left '+'
> %left REP
> %nonassoc ATOM
>
> Russ

Ok, thanks, this seems to have solved it.
So the %nonassoc says to the parser that
(REP block) ATOM
is the right decision as opposed to
REP (block ATOM)
right?

The sad point really is that I couldn't find a good explanation for
what %nonassoc really means. Everybody just says that it precludes a
situation where
'the same operator would be twice in a row...'
which isn't quite telling, when one realizes that the parser really
does not know what an 'operator' is... (both the documentation of
bison (Donnelly, Stallman) and of yacc (Johnson) are just like that; I
couldn't find any better)
So could you please say, what %nonassoc really assures?

Thanks
Ruda



  reply	other threads:[~2009-10-21 19:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-21 17:52 Rudolf Sykora
2009-10-21 18:03 ` Rudolf Sykora
2009-10-21 18:46 ` Skip Tavakkolian
2009-10-21 19:44   ` Rudolf Sykora
2009-10-21 18:47 ` Russ Cox
2009-10-21 19:41   ` Rudolf Sykora [this message]
2009-10-21 19:48     ` Rudolf Sykora
2009-10-21 20:21     ` Russ Cox
2009-10-21 20:28       ` Rudolf Sykora
2009-10-21 20:03 ` Bakul Shah
2009-10-21 20:18   ` Rudolf Sykora

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=a560a5d00910211241l6307cbe8m4bfe50e6b85f060d@mail.gmail.com \
    --to=rudolf.sykora@gmail.com \
    --cc=9fans@9fans.net \
    /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).