Skip to Content.
Sympa Menu

k-user - Re: [K-user] Using Float literals inside rules

k-user AT lists.cs.illinois.edu

Subject: K-user mailing list

List archive

Re: [K-user] Using Float literals inside rules


Chronological Thread 
  • From: Charles Jacobsen <charlie.jacobsen AT utah.edu>
  • To: "k-user AT cs.uiuc.edu" <k-user AT cs.uiuc.edu>
  • Subject: Re: [K-user] Using Float literals inside rules
  • Date: Mon, 8 Jul 2013 15:55:03 +0000
  • Accept-language: en-US
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
  • List-id: <k-user.cs.uiuc.edu>

I might have it set up incorrectly, or I may have misunderstood. This has become low priority on my end, so it's really just fyi. When I kompile:

module TEST

   syntax Expr ::= "1.0 + 2.0"

   rule 1.0 + 2.0 => 1.0 +Float 2.0  [structural]

endmodule

I get this:

[Warning] Parser: Parsing ambiguity. Arbitrarily choosing the first.
1:
   1.0 + 2.0 => 1.0 +Float 2.0
2:
   1.0 + 2.0 => 1.0 +Float 2.0

but when I kompile:

module TEST

   syntax Expr ::= "1 + 2"

   rule 1 + 2 => 1 +Int 2  [structural]

endmodule

it works with no error.


From: Radu Mereuta [headness13 AT gmail.com]
Sent: Thursday, July 04, 2013 6:05 AM
To: Charles Jacobsen
Cc: k-user AT cs.uiuc.edu
Subject: Re: [K-user] Using Float literals inside rules

Hi Charles,

Sorry for the late response.

It can't give ambiguous parsing in those examples, because you didn't define the + operator. The only way to parse, is as an Expr, just like you declared it.

I think you oversimplified the example, and the issue may be related to something that's not present here.

Radu
K-developer


On Wed, Jun 19, 2013 at 10:24 PM, Charles Jacobsen <charlie.jacobsen AT utah.edu> wrote:
Hello again,

This may be a bug, but I am not sure:

module TEST

   syntax Expr ::= "1.0 + 2.0"

   rule 1.0 + 2.0 => 1.0 +Float 2.0  [structural]

endmodule

leads to a "parsing ambiguity" error, while

module TEST

   syntax Expr ::= "1 + 2"

   rule 1 + 2 => 1 +Int 2  [structural]

endmodule

does not (and produces 3 when given the program "1+2"). I suspect it's because '.' has special meaning inside k rules. Parsing ambiguity does not result when a Float literal is used inside of the "where" clause of a k rule.

_______________________________________________
k-user mailing list
k-user AT cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/k-user





Archive powered by MHonArc 2.6.16.

Top of Page