-
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.
- Loading branch information
1 parent
50d04af
commit b8703b5
Showing
8 changed files
with
111 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
```k | ||
module RUST-ERROR | ||
imports private RUST-REPRESENTATION | ||
rule concat(V:Value, L:ValueList) => V , L | ||
rule concat(_:Value, E:SemanticsError) => E | ||
rule concat(E:SemanticsError, _:ValueListOrError) => E | ||
rule concat(E:ValueOrError, L:ValueListOrError) | ||
=> error("unexpected branch (concat(ValueOrError, ValueListOrError))", ListItem(E) ListItem(L)) | ||
[owise] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
```k | ||
module RUST-EXPRESSION-ASSIGNMENTS | ||
imports private COMMON-K-CELL | ||
imports private RUST-EXECUTION-CONFIGURATION | ||
imports private RUST-SHARED-SYNTAX | ||
imports private RUST-VALUE-SYNTAX | ||
rule | ||
<k> | ||
ptrValue(ptr(P:Int), _) = ptrValue(_, V:Value) | ||
=> ptrValue(null, tuple(.ValueList)) | ||
... | ||
</k> | ||
<values> | ||
Values:Map => Values[P <- V] | ||
</values> | ||
requires P in_keys(Values) | ||
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,23 @@ | ||
```k | ||
module RUST-EXPRESSION-EXPRESSION-LIST | ||
imports RUST-REPRESENTATION | ||
imports RUST-VALUE-SYNTAX | ||
rule evaluate(L:ExpressionList) => evaluate(expressionListToValueList(L)) | ||
rule isValueWithPtr(.ExpressionList) => true | ||
rule isValueWithPtr(E:Expression , T:ExpressionList) | ||
=> isValueWithPtr(E) andBool isValueWithPtr(T) | ||
syntax ValueListOrError ::= expressionListToValueList(ExpressionList) [function, total] | ||
rule expressionListToValueList(.ExpressionList) => .ValueList | ||
rule expressionListToValueList(ptrValue(_, V:Value) , T:ExpressionList) | ||
=> concat(V , expressionListToValueList(T)) | ||
rule expressionListToValueList(E:Expression , T:ExpressionList) | ||
=> error("Unrecognized expression (expressionListToValueList)", ListItem(E) ListItem(T)) | ||
[owise] | ||
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,29 @@ | ||
```k | ||
module RUST-EXPRESSION-TUPLE | ||
imports RUST-REPRESENTATION | ||
imports RUST-VALUE-SYNTAX | ||
rule ():Expression => ptrValue(null, tuple(.ValueList)) | ||
rule (E:Expression , ):TupleExpression | ||
=> tupleExpression(E , .TupleElementsNoEndComma) | ||
rule (E:Expression , T:TupleElementsNoEndComma):TupleExpression | ||
=> tupleExpression(E , T) | ||
rule (E:Expression , T:TupleElementsNoEndComma,):TupleExpression | ||
=> tupleExpression(E , T) | ||
syntax Instruction ::= tupleExpression(TupleElementsNoEndComma) | ||
rule (.K => evaluate(tupleElementsToExpressionList(Es))) | ||
~> tupleExpression(Es:TupleElementsNoEndComma) | ||
rule (evaluate(L:ValueList) ~> tupleExpression(_:TupleElementsNoEndComma)) | ||
=> ptrValue(null, tuple(L)) | ||
syntax ExpressionList ::= tupleElementsToExpressionList(TupleElementsNoEndComma) [function, total] | ||
rule tupleElementsToExpressionList(.TupleElementsNoEndComma) => .ExpressionList | ||
rule tupleElementsToExpressionList(E:Expression , Es:TupleElementsNoEndComma) | ||
=> E , tupleElementsToExpressionList(Es) | ||
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