Skip to Content.
Sympa Menu

maude-help - [Maude-help] Re: simple calculator program

maude-help AT lists.cs.illinois.edu

Subject: Maude-help mailing list

List archive

[Maude-help] Re: simple calculator program


Chronological Thread 
  • From: "Kok Wei Shiung" <kwshiung AT yoyo.monash.edu.my>
  • To: maude-help AT banyan.cs.uiuc.edu
  • Subject: [Maude-help] Re: simple calculator program
  • Date: Thu, 9 Oct 2003 17:03:56 +0800
  • List-archive: <http://maude.cs.uiuc.edu/pipermail/maude-help/>
  • List-id: Maude help list <maude-help.maude.cs.uiuc.edu>

Hi maude-help,

I've encountered problem on this piece of code:

fmod CALC is
protecting MACHINE-INT .

sorts first second answer .
subsorts first < second < answer < MachineInt .

op _ : MachineInt : -> first [assoc] .
op _*_ : MachineInt MachineInt : -> first [assoc] .
op _/_ : MachineInt MachineInt : -> first [assoc] .
op _+_ : first first : -> second [assoc] .
op _-_ : first first : -> second [assoc] .
op calc : second -> MachineInt .

var N1 : MachineInt .
var N2 : MachineInt .

eq calc( N1 ) = N1 .
ceq calc( N1 + N2 ) = N1 + N2 .
ceq calc( N1 - N2 ) = N1 - N2 .
eq calc( N1 * N2 ) = N1 * N2 .
eq calc( N1 / N2 ) = N1 / N2 .
end fmod)

This is a simple calculator program. It suppose to take an equation, evaluate
the (*/) first then follow by (+-). An Error message 'no loop state' appear
when i load it into maude. Is this error caused by the grammar itself or
syntax error of the code? How to fix this problem?


Thank you!


from,
Vincent


--
Open WebMail Project (http://openwebmail.org)





Archive powered by MHonArc 2.6.16.

Top of Page