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: Radu Mereuta <headness13 AT gmail.com>
  • To: Charles Jacobsen <charlie.jacobsen AT utah.edu>
  • Cc: "k-user AT cs.uiuc.edu" <k-user AT cs.uiuc.edu>
  • Subject: Re: [K-user] Using Float literals inside rules
  • Date: Thu, 4 Jul 2013 15:05:28 +0300
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
  • List-id: <k-user.cs.uiuc.edu>

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