-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If expressions #82
If expressions #82
Conversation
* Arrange the cells for easier debugging * Create a list of traits to help with mx preprocessing * Static method calls * Integer - value conversions * Ignore generic args when casting structs * Framework for executing Mx+Rust * Framework for testing Mx+Rust * Implement storage functions * Implement storage accessors * Implement BigUint::from * Default storage values * Storage set_if_empty * Storage tests --------- Co-authored-by: Virgil <[email protected]>
Addresses #17 . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you may want to make sure that these work before closing #17:
fn test_if1(&self) { // No return type
if true {
10u64
} else {
11u64
};
}
and
fn test_if2(&self) -> u64 {
if true {
10u64
} else {
11u64
};
11
}
rule S:ExpressionWithBlock ; => S | ||
|
||
rule (if ptrValue(_, true) S:BlockExpression):ExpressionWithBlock => S [owise] | ||
rule (if ptrValue(_, false) _:BlockExpression):ExpressionWithBlock => . [owise] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the standard is to use ".K" instead of ".". It also produces this warning:
[Warning] Compiler: Use of deprecated production found; this syntax may be
removed in the future.
Source(/mnt/data/pi-squared/rust-demo-semantics/rust-semantics/execution/conditionals.md)
Location(10,75,10,76)
10 | rule (if ptrValue(_, false) _:BlockExpression):ExpressionWithBlock =>
. [owise]
.
^
rule (if ptrValue(_, true) S:BlockExpression):ExpressionWithBlock => S [owise] | ||
rule (if ptrValue(_, false) _:BlockExpression):ExpressionWithBlock => . [owise] | ||
|
||
rule (if ptrValue(_, true) A:BlockExpression else _:IfElseExpression):ExpressionWithBlock => A | ||
rule (if ptrValue(_, false) _:BlockExpression else B:IfElseExpression):ExpressionWithBlock => B |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the 4 rules above are actually part of expression evaluation.
imports RUST-SHARED-SYNTAX | ||
imports RUST-VALUE-SYNTAX | ||
|
||
rule S:ExpressionWithBlock ; => S |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not specific to if
so I would put it in a different file (block-expressions.md maybe?)
Also addresses #30. |
Introducing if expressions to our rust-lite semantics.