Skip to Content.
Sympa Menu

maude-help - Re: [[Maude-help] ] ambiguous parsing

maude-help AT lists.cs.illinois.edu

Subject: Maude-help mailing list

List archive

Re: [[Maude-help] ] ambiguous parsing


Chronological Thread 
  • From: Paco Durán <fdm AT uma.es>
  • To: maude-help AT lists.cs.illinois.edu
  • Cc: Francisco Durán <fdm AT uma.es>, Francesoc Bongiovanni <bongiovanni AT gmail.com>
  • Subject: Re: [[Maude-help] ] ambiguous parsing
  • Date: Wed, 13 Apr 2016 20:39:17 +0200

Hi Francesco,

The ambiguity possibly comes from operators _-_, -_ and __ (for lists). But
without the module, var declarations, etc. is difficult to confirm.

If this is the problem, several solutions to confirm and work around:
- use prefix syntax, or something like A + - B
- rename the __ list constructor to something else like _:_, _::_, ...

If you don't really need Full Maude (OO syntax, parameterized views, extra
module expressions, ...), perhaps you can remove the parentheses and use core
Maude, it typically gives much better error info.

Cheers,

Francisco


> On 13 Apr 2016, at 14:39, Francesoc Bongiovanni
> <bongiovanni AT gmail.com>
> wrote:
>
> Hello,
>
> I am stuck with some piece of Maude code and I am circling aroung it.
>
> I basically coded the Pearson Correlation Coefficient function in Maude,
> and came up with this bit of code :
>
> op sizeOf : List{Float} -> Float .
> eq sizeOf(F1) = 1.0 .
> eq sizeOf(F1 V1) = (1.0 + sizeOf(V1)) .
>
> op sumAB : List{Float} List{Float} -> Float .
> eq sumAB(V1,V2) = foldl plusF 0.0 (zipWith plusF V1 V2) .
>
> op sumA : List{Float} -> Float .
> eq sumA(V1) = foldl plusF 0.0 V1 .
>
> op sumOfSquare : List{Float} -> Float .
> eq sumOfSquare(V1) = foldl plusF 0.0 (map square V1) .
>
> op num : List{Float} List{Float} -> Float .
> eq num(V1,V2) = ( ( sumAB(V1,V2) * sizeOf(V1) ) - ( sumA(V1) *
> sumA(V2) ) ) .
>
> I ll spare you the denum part.
>
> When I try to load the module containing the op, in Full-Maude, it gives me
> the following error :
>
> Warning: Ambiguous parsing for (num(V1,V2))=(((sumAB(V1,V2)* sizeOf(V1))-
> (sumA(V1)* sumA(V2))))
> Error: no parse for eq num(V1,V2) = ((sumAB(V1,V2)* sizeOf(V1))-(sumA(V1)*
> sumA(V2)))
> Warning: Ambiguous parsing for (num(V1,V2))=(((sumAB(V1,V2)* sizeOf(V1))-
> (sumA(V1)* sumA(V2))))
> Error: no parse for eq num(V1,V2) = ((sumAB(V1,V2)* sizeOf(V1))-(sumA(V1)*
> sumA(V2)))
>
> When I change the `-` sign with a `+` sign the error goes away...I dont
> really
> get it...how do I keep the minus sign without that error ?
>
> Thanks for your insights !
>
> - Francesco




Archive powered by MHonArc 2.6.16.

Top of Page