k-user AT lists.cs.illinois.edu
Subject: K-user mailing list
List archive
- 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 [function] attribute does not add syntax to sort?
- Date: Wed, 10 Jul 2013 20:00:57 +0000
- Accept-language: en-US
- List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
- List-id: <k-user.cs.uiuc.edu>
(
Oops, forgot the Bool, sorry for the flood of emails:
syntax Bool ::= K "&&" K [function]
rule false && K:K => false
rule true && B:Bool => B
)
Oops, forgot the Bool, sorry for the flood of emails:
syntax Bool ::= K "&&" K [function]
rule false && K:K => false
rule true && B:Bool => B
)
From: k-user-bounces AT cs.uiuc.edu [k-user-bounces AT cs.uiuc.edu] on behalf of Charles Jacobsen [charlie.jacobsen AT utah.edu]
Sent: Wednesday, July 10, 2013 1:59 PM
To: k-user AT cs.uiuc.edu
Subject: Re: [K-user] Using [function] attribute does not add syntax to sort?
Sent: Wednesday, July 10, 2013 1:59 PM
To: k-user AT cs.uiuc.edu
Subject: Re: [K-user] Using [function] attribute does not add syntax to sort?
Nevermind, unless you guys have a better way. I wrote a new conjunction construct:
syntax ::= K "&&" K [function]
rule false && K:K => false
rule true && B:Bool => B
This seems to work as expected, making && short-circuiting.
syntax ::= K "&&" K [function]
rule false && K:K => false
rule true && B:Bool => B
This seems to work as expected, making && short-circuiting.
From: k-user-bounces AT cs.uiuc.edu [k-user-bounces AT cs.uiuc.edu] on behalf of Charles Jacobsen [charlie.jacobsen AT utah.edu]
Sent: Wednesday, July 10, 2013 12:35 PM
To: k-user AT cs.uiuc.edu
Subject: Re: [K-user] Using [function] attribute does not add syntax to sort?
Sent: Wednesday, July 10, 2013 12:35 PM
To: k-user AT cs.uiuc.edu
Subject: Re: [K-user] Using [function] attribute does not add syntax to sort?
(
I forgot to remove the comments from the second TEST module, should be:
module TEST
syntax Val ::= Int | Bool
// -Not- using the [function] attribute on foo.
syntax Bool ::= "foo" "(" Val ")" [function]
rule foo(B:Bool) => B
syntax Bool ::= "is-bool" "(" Val ")" [function]
rule is-bool(B:Bool) => true
rule is-bool(I:Int) => false
// This expr -will- reduce to true.
configuration <k> is-bool( foo(5) ) </k>
endmodule
)
I forgot to remove the comments from the second TEST module, should be:
module TEST
syntax Val ::= Int | Bool
// -Not- using the [function] attribute on foo.
syntax Bool ::= "foo" "(" Val ")" [function]
rule foo(B:Bool) => B
syntax Bool ::= "is-bool" "(" Val ")" [function]
rule is-bool(B:Bool) => true
rule is-bool(I:Int) => false
// This expr -will- reduce to true.
configuration <k> is-bool( foo(5) ) </k>
endmodule
)
From: k-user-bounces AT cs.uiuc.edu [k-user-bounces AT cs.uiuc.edu] on behalf of Charles Jacobsen [charlie.jacobsen AT utah.edu]
Sent: Wednesday, July 10, 2013 12:31 PM
To: k-user AT cs.uiuc.edu
Subject: [K-user] Using [function] attribute does not add syntax to sort?
Sent: Wednesday, July 10, 2013 12:31 PM
To: k-user AT cs.uiuc.edu
Subject: [K-user] Using [function] attribute does not add syntax to sort?
When I kompile and krun the following, the k cell does not reduce to true, as I was expecting. Notice that I did not include a rule for foo when the input
is an integer, so foo(5) cannot reduce.
module TEST
syntax Val ::= Int | Bool
// Using the [function] attribute on foo.
syntax Bool ::= "foo" "(" Val ")" [function]
rule foo(B:Bool) => B
syntax Bool ::= "is-bool" "(" Val ")" [function]
rule is-bool(B:Bool) => true
rule is-bool(I:Int) => false
// This expr will not reduce to true.
configuration <k> is-bool( foo(5) ) </k>
endmodule
The k-cell in the following -does- reduce when the [function] attribute is removed from foo:
module TEST
syntax Val ::= Int | Bool
// Using the [function] attribute on foo.
syntax Bool ::= "foo" "(" Val ")"
rule foo(B:Bool) => B
syntax Bool ::= "is-bool" "(" Val ")" [function]
rule is-bool(B:Bool) => true
rule is-bool(I:Int) => false
// This expr will not reduce to true.
configuration <k> is-bool( foo(5) ) </k>
endmodule
I'm trying to use andBool inside 'when' conditions without needing to worry about whether all terms reduce (if one reduces to false, that should be sufficient).
Thanks guys, Charlie
module TEST
syntax Val ::= Int | Bool
// Using the [function] attribute on foo.
syntax Bool ::= "foo" "(" Val ")" [function]
rule foo(B:Bool) => B
syntax Bool ::= "is-bool" "(" Val ")" [function]
rule is-bool(B:Bool) => true
rule is-bool(I:Int) => false
// This expr will not reduce to true.
configuration <k> is-bool( foo(5) ) </k>
endmodule
The k-cell in the following -does- reduce when the [function] attribute is removed from foo:
module TEST
syntax Val ::= Int | Bool
// Using the [function] attribute on foo.
syntax Bool ::= "foo" "(" Val ")"
rule foo(B:Bool) => B
syntax Bool ::= "is-bool" "(" Val ")" [function]
rule is-bool(B:Bool) => true
rule is-bool(I:Int) => false
// This expr will not reduce to true.
configuration <k> is-bool( foo(5) ) </k>
endmodule
I'm trying to use andBool inside 'when' conditions without needing to worry about whether all terms reduce (if one reduces to false, that should be sufficient).
Thanks guys, Charlie
- [K-user] Using [function] attribute does not add syntax to sort?, Charles Jacobsen, 07/10/2013
- Re: [K-user] Using [function] attribute does not add syntax to sort?, Charles Jacobsen, 07/10/2013
- Re: [K-user] Using [function] attribute does not add syntax to sort?, Charles Jacobsen, 07/10/2013
- Re: [K-user] Using [function] attribute does not add syntax to sort?, Charles Jacobsen, 07/10/2013
- Re: [K-user] Using [function] attribute does not add syntax to sort?, Rosu, Grigore, 07/10/2013
- Re: [K-user] Using [function] attribute does not add syntax to sort?, Charles Jacobsen, 07/10/2013
- Re: [K-user] Using [function] attribute does not add syntax to sort?, Charles Jacobsen, 07/10/2013
- Re: [K-user] Using [function] attribute does not add syntax to sort?, Charles Jacobsen, 07/10/2013
- Re: [K-user] Using [function] attribute does not add syntax to sort?, Rosu, Grigore, 07/10/2013
- Re: [K-user] Using [function] attribute does not add syntax to sort?, Charles Jacobsen, 07/10/2013
- Re: [K-user] Using [function] attribute does not add syntax to sort?, Charles Jacobsen, 07/10/2013
- Re: [K-user] Using [function] attribute does not add syntax to sort?, Charles Jacobsen, 07/10/2013
Archive powered by MHonArc 2.6.16.