Skip to Content.
Sympa Menu

maude-help - Re: [Maude-help] Why is (1 + 2 - 3) Ambiguous?

maude-help AT lists.cs.illinois.edu

Subject: Maude-help mailing list

List archive

Re: [Maude-help] Why is (1 + 2 - 3) Ambiguous?


Chronological Thread 
  • From: Steven Eker <eker AT csl.sri.com>
  • To: maude-help AT cs.uiuc.edu
  • Cc: najem AT acm.kuniv.edu
  • Subject: Re: [Maude-help] Why is (1 + 2 - 3) Ambiguous?
  • Date: Mon, 6 Jun 2011 20:23:18 -0700
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/maude-help>
  • List-id: <maude-help.cs.uiuc.edu>
  • Organization: SRI International

_+_ is assoc and therefore doesn't really need to associate left or right.
However the MSCP10 parser that Maude uses doesn't understand associative
symbols so the system has to force an associativity to avoid trivial
ambiguities. By default it uses gather to force right associativity since
this
is the convention for dealing with associative lists and the code is
optimized
(linear vs quadratic time) to deal with long right associative lists.

As these two examples show, the default assoc gather is wrong for _+_

I think this can be fixed by putting gather (E e) for _+_ in the prelude.

Steven

On Monday 30 May 2011 08:40:28 am Chucky Ellison wrote:
> Worse yet, 1 - 2 + 3 actually fails to parse. It isn't even considered
> ambiguous.
>
> Maude> rew 1 - 2 + 3 .
> Warning: <standard input>, line 3: didn't expect token +:
> 1 - 2 + <---*HERE*
> Warning: <standard input>, line 3: no parse for term.
>
> -Chucky
>
> On Mon, May 30, 2011 at 10:24 AM, Ziad H. Najem
> <najem AT acm.kuniv.edu>
> wrote:
> > Core Maude 2.6 reports the expression (1+2-3) is ambiguous (as shown
> > below)
> >
> > Shouldn't the gather rules (associativity) resolve the ambiguity?
> >
> > - Ziad
> >
> >
> > -------
> > Maude> red in INT : 1 + 2 - 3 .
> > Warning: <standard input>, line 2: ambiguous term, two parses are:
> > 1 + (2 - 3)
> > -versus-
> > (1 + 2) - 3
> >
> > Arbitrarily taking the first as correct.
> > reduce in INT : 1 + (2 - 3) .
> > rewrites: 2 in 0ms cpu (0ms real) (~ rewrites/second)
> > result Zero: 0
> > ------
> >
> >
> > _______________________________________________
> > Maude-help mailing list
> > Maude-help AT cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/maude-help
>



  • Re: [Maude-help] Why is (1 + 2 - 3) Ambiguous?, Steven Eker, 06/06/2011

Archive powered by MHonArc 2.6.16.

Top of Page