-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging with main and adjustments to the integer relational operations
- Loading branch information
Showing
26 changed files
with
369 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
```k | ||
requires "expression/calls.md" | ||
requires "expression/integer-operations.md" | ||
requires "expression/constants.md" | ||
requires "expression/casts.md" | ||
requires "expression/literals.md" | ||
requires "expression/references.md" | ||
requires "expression/tools.md" | ||
requires "expression/variables.md" | ||
module RUST-EXPRESSION | ||
imports private RUST-CASTS | ||
imports private RUST-EXPRESSION-CALLS | ||
imports private RUST-EXPRESSION-CONSTANTS | ||
imports private RUST-EXPRESSION-LITERALS | ||
imports private RUST-EXPRESSION-REFERENCES | ||
imports private RUST-EXPRESSION-TOOLS | ||
imports private RUST-EXPRESSION-VARIABLES | ||
imports private RUST-EXPRESSION-CONSTANTS | ||
imports private RUST-INTEGER-OPERATIONS | ||
endmodule | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
```k | ||
module RUST-EXPRESSION-CALLS | ||
imports private COMMON-K-CELL | ||
imports private RUST-SHARED-SYNTAX | ||
imports private RUST-EXECUTION-CONFIGURATION | ||
imports private RUST-EXPRESSION-TOOLS | ||
imports private RUST-REPRESENTATION | ||
imports private RUST-SHARED-SYNTAX | ||
syntax Instruction ::= methodCall | ||
( traitName: TypePath | ||
, method: Identifier | ||
, params: CallParamsList | ||
, reversedNormalizedParams: NormalizedCallParams | ||
) | ||
syntax NormalizedCallParams ::= reverse(NormalizedCallParams, NormalizedCallParams) [function, total] | ||
rule reverse(.NormalizedCallParams, R:NormalizedCallParams) => R | ||
rule reverse((P, Ps:NormalizedCallParams), R:NormalizedCallParams) => reverse(Ps, (P, R)) | ||
rule SelfName:Expression . MethodName:Identifier ( ) | ||
=> methodCall(... self: SelfName, method: MethodName, params: .CallParamsList) | ||
rule SelfName:Expression . MethodName:Identifier ( Args:CallParamsList ) | ||
=> methodCall(... self: SelfName, method: MethodName, params: Args) | ||
rule SelfName:Expression . MethodName:Identifier ( Args:CallParamsList, ) | ||
=> methodCall(... self: SelfName, method: MethodName, params: Args) | ||
rule | ||
<k> | ||
methodCall | ||
(... self: ptrValue(ptr(A) #as P, _) | ||
, method: MethodName:Identifier | ||
, params: Args:CallParamsList | ||
) | ||
=> methodCall | ||
(... traitName: TraitName | ||
, method: MethodName | ||
, params: Args | ||
, reversedNormalizedParams: P, .NormalizedCallParams | ||
) | ||
... | ||
</k> | ||
<values> A |-> struct(TraitName:TypePath, _) ... </values> | ||
requires isValueWithPtr(Args) | ||
rule methodCall | ||
(... traitName: _TraitName:TypePath | ||
, method: _MethodName:Identifier | ||
, params: (ptrValue(ptr(_) #as P:Ptr, _:Value) , Cps:CallParamsList) => Cps | ||
, reversedNormalizedParams: Args:NormalizedCallParams | ||
=> P, Args | ||
) | ||
rule | ||
<k> | ||
methodCall | ||
(... traitName: _TraitName:TypePath | ||
, method: _MethodName:Identifier | ||
, params: (ptrValue(null, V:Value) , Cps:CallParamsList) => Cps | ||
, reversedNormalizedParams: Args:NormalizedCallParams | ||
=> ptr(NextId), Args | ||
) | ||
... | ||
</k> | ||
<next-value-id> NextId:Int => NextId +Int 1 </next-value-id> | ||
<values> Values:Map => Values[NextId <- V] </values> | ||
rule | ||
methodCall | ||
(... traitName: TraitName:TypePath | ||
, method: MethodName:Identifier | ||
, params: .CallParamsList | ||
, reversedNormalizedParams: Args:NormalizedCallParams | ||
) | ||
=> normalizedMethodCall | ||
( TraitName | ||
, MethodName | ||
, reverse(Args, .NormalizedCallParams) | ||
) | ||
// Apparently contexts need the type of the HOLE to be K, and I'm not sure | ||
// how to transform CallParamsList in some sort of K combination in a | ||
// reasonable way. We're using heat/cool rules instead. | ||
rule (.K => HOLE) ~> HOLE:Expression , _:CallParamsList | ||
[heat, result(ValueWithPtr)] | ||
rule (HOLE:Expression ~> (_:Expression , L:CallParamsList):CallParamsList) | ||
=> HOLE , L | ||
[cool, result(ValueWithPtr)] | ||
rule (.K => HOLE) ~> V:Expression , HOLE:CallParamsList | ||
requires isValueWithPtr(V) | ||
[heat, result(ValueWithPtr)] | ||
rule (HOLE:CallParamsList ~> V:Expression , _:CallParamsList) | ||
=> V , HOLE | ||
requires isValueWithPtr(V) | ||
[cool, result(ValueWithPtr)] | ||
endmodule | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
```k | ||
module RUST-EXPRESSION-REFERENCES | ||
imports private RUST-REPRESENTATION | ||
imports private RUST-SHARED-SYNTAX | ||
rule & E:Expression => E | ||
endmodule | ||
``` |
Oops, something went wrong.