diff --git a/mx-rust-semantics/main/modules/biguint.md b/mx-rust-semantics/main/modules/biguint.md index 9c333d0..63fcffb 100644 --- a/mx-rust-semantics/main/modules/biguint.md +++ b/mx-rust-semantics/main/modules/biguint.md @@ -14,7 +14,7 @@ module MX-RUST-MODULES-BIGUINT ( #token("BigUint", "Identifier"):Identifier , #token("from", "Identifier"):Identifier , ( ptr(ValueId:Int) - , .NormalizedCallParams + , .PtrList ) ) // TODO: Should check that V >= 0 diff --git a/mx-rust-semantics/main/modules/storage.md b/mx-rust-semantics/main/modules/storage.md index e72ad16..7f281d6 100644 --- a/mx-rust-semantics/main/modules/storage.md +++ b/mx-rust-semantics/main/modules/storage.md @@ -14,7 +14,7 @@ module MX-RUST-MODULES-STORAGE , #token("new", "Identifier"):Identifier , ( ptr(KeyId:Int) , ptr(ResultTypeId:Int) - , .NormalizedCallParams + , .PtrList ) ) => mxRustNewValue @@ -32,7 +32,7 @@ module MX-RUST-MODULES-STORAGE , #token("set", "Identifier"):Identifier , ( ptr(SelfId:Int) , ptr(ValueId:Int) - , .NormalizedCallParams + , .PtrList ) ) => rustValuesToMx((V, .ValueList), (mxStringValue(StorageKey), .MxValueList)) ~> MX#storageStore @@ -56,7 +56,7 @@ module MX-RUST-MODULES-STORAGE , #token("set_if_empty", "Identifier"):Identifier , ( ptr(SelfId:Int) , ptr(ValueId:Int) - , .NormalizedCallParams + , .PtrList ) ) => MX#storageLoad(mxStringValue(StorageKey), rustDestination(-1, noType)) @@ -89,7 +89,7 @@ module MX-RUST-MODULES-STORAGE ( #token("SingleValueMapper", "Identifier"):Identifier #as Type:Identifier , #token("get", "Identifier"):Identifier , ( ptr(SelfId:Int) - , .NormalizedCallParams + , .PtrList ) ) => MX#storageLoad(mxStringValue(StorageKey), rustDestination(NextId, ResultType)) diff --git a/rust-semantics/execution/calls.md b/rust-semantics/execution/calls.md index 5362fe6..0b3896b 100644 --- a/rust-semantics/execution/calls.md +++ b/rust-semantics/execution/calls.md @@ -12,14 +12,14 @@ module RUST-CALLS // https://doc.rust-lang.org/stable/reference/expressions/method-call-expr.html syntax Instruction ::= "clearLocalState" - | setArgs(NormalizedCallParams, NormalizedFunctionParameterList) + | setArgs(PtrList, NormalizedFunctionParameterList) rule normalizedMethodCall( TraitName:TypePath, MethodName:Identifier, - Args:NormalizedCallParams + Args:PtrList ) => pushLocalState ~> clearLocalState ~> setArgs(Args, Params) @@ -42,12 +42,12 @@ module RUST-CALLS _ => .Map rule setArgs - ( (CP:Ptr, CPs:NormalizedCallParams) + ( (CP:Ptr, CPs:PtrList) , (P:NormalizedFunctionParameter, Ps:NormalizedFunctionParameterList) ) => setArg(CP, P) ~> setArgs(CPs, Ps) - rule setArgs(.NormalizedCallParams, .NormalizedFunctionParameterList) => .K + rule setArgs(.PtrList, .NormalizedFunctionParameterList) => .K syntax Instruction ::= setArg(Ptr, NormalizedFunctionParameter) diff --git a/rust-semantics/expression/calls.md b/rust-semantics/expression/calls.md index 5f365bf..2c7957c 100644 --- a/rust-semantics/expression/calls.md +++ b/rust-semantics/expression/calls.md @@ -12,22 +12,22 @@ module RUST-EXPRESSION-CALLS ( traitName: TypePath , method: Identifier , params: CallParamsList - , reversedNormalizedParams: NormalizedCallParams + , reversedNormalizedParams: PtrList ) syntax Instruction ::= staticMethodCall ( traitName: TypePath , method: Identifier , params: CallParamsList - , reversedNormalizedParams: NormalizedCallParams + , reversedNormalizedParams: PtrList ) syntax Instruction ::= reverseNormalizeParams ( params: CallParamsList - , reversedNormalizedParams: NormalizedCallParams + , reversedNormalizedParams: PtrList ) - syntax NormalizedCallParams ::= reverse(NormalizedCallParams, NormalizedCallParams) [function, total] - rule reverse(.NormalizedCallParams, R:NormalizedCallParams) => R - rule reverse((P, Ps:NormalizedCallParams), R:NormalizedCallParams) => reverse(Ps, (P, R)) + syntax PtrList ::= reverse(PtrList, PtrList) [function, total] + rule reverse(.PtrList, R:PtrList) => R + rule reverse((P, Ps:PtrList), R:PtrList) => reverse(Ps, (P, R)) rule SelfName:Expression . MethodName:Identifier ( ) => methodCall(... self: SelfName, method: MethodName, params: .CallParamsList) @@ -41,7 +41,7 @@ module RUST-EXPRESSION-CALLS ( .K => reverseNormalizeParams (... params: Args - , reversedNormalizedParams: P, .NormalizedCallParams + , reversedNormalizedParams: P, .PtrList ) ~> TraitName ) @@ -58,7 +58,7 @@ module RUST-EXPRESSION-CALLS rule ( reverseNormalizeParams (... params: .CallParamsList - , reversedNormalizedParams: Args:NormalizedCallParams + , reversedNormalizedParams: Args:PtrList ) ~> TraitName:TypePath ~> methodCall @@ -70,19 +70,19 @@ module RUST-EXPRESSION-CALLS => normalizedMethodCall ( TraitName , MethodName - , reverse(Args, .NormalizedCallParams) + , reverse(Args, .PtrList) ) rule reverseNormalizeParams (... params: (ptrValue(ptr(_) #as P:Ptr, _:Value) , Cps:CallParamsList) => Cps - , reversedNormalizedParams: Args:NormalizedCallParams + , reversedNormalizedParams: Args:PtrList => P, Args ) rule reverseNormalizeParams (... params: (ptrValue(null, V:Value) , Cps:CallParamsList) => Cps - , reversedNormalizedParams: Args:NormalizedCallParams + , reversedNormalizedParams: Args:PtrList => ptr(NextId), Args ) ... @@ -103,7 +103,7 @@ module RUST-EXPRESSION-CALLS ( .K => reverseNormalizeParams (... params: Args - , reversedNormalizedParams: .NormalizedCallParams + , reversedNormalizedParams: .PtrList ) ) ~> staticMethodCall @@ -116,7 +116,7 @@ module RUST-EXPRESSION-CALLS rule ( reverseNormalizeParams (... params: .CallParamsList - , reversedNormalizedParams: Args:NormalizedCallParams + , reversedNormalizedParams: Args:PtrList ) ~> staticMethodCall (... trait: TraitName:TypePath @@ -127,7 +127,7 @@ module RUST-EXPRESSION-CALLS => normalizedMethodCall ( TraitName , MethodName - , reverse(Args, .NormalizedCallParams) + , reverse(Args, .PtrList) ) // Apparently contexts need the type of the HOLE to be K, and I'm not sure diff --git a/rust-semantics/representation.md b/rust-semantics/representation.md index 58d8181..429a5f3 100644 --- a/rust-semantics/representation.md +++ b/rust-semantics/representation.md @@ -60,9 +60,9 @@ module RUST-REPRESENTATION syntax NormalizedFunctionParameter ::= ValueName ":" Type syntax NormalizedFunctionParameterList ::= List{NormalizedFunctionParameter, ","} - syntax NormalizedCallParams ::=List{Ptr, ","} + syntax PtrList ::=List{Ptr, ","} - syntax Instruction ::= normalizedMethodCall(TypePath, Identifier, NormalizedCallParams) + syntax Instruction ::= normalizedMethodCall(TypePath, Identifier, PtrList) | implicitCastTo(Type) | methodCall ( self: Expression diff --git a/rust-semantics/test/execution.md b/rust-semantics/test/execution.md index 0076655..61a4a68 100644 --- a/rust-semantics/test/execution.md +++ b/rust-semantics/test/execution.md @@ -44,21 +44,21 @@ module RUST-EXECUTION-TEST rule call P:TypePath . Name:Identifier - => buildTestMethodCall(P, Name, .NormalizedCallParams, paramsLength(Params)) + => buildTestMethodCall(P, Name, .PtrList, paramsLength(Params)) ... P Name Params - syntax TestExecution ::= buildTestMethodCall(TypePath, Identifier, NormalizedCallParams, Int) + syntax TestExecution ::= buildTestMethodCall(TypePath, Identifier, PtrList, Int) rule buildTestMethodCall( _TraitName:TypePath, _MethodName:Identifier, - Args:NormalizedCallParams => (ValueId , Args), + Args:PtrList => (ValueId , Args), ParamCount:Int => ParamCount -Int 1 ) ... @@ -70,7 +70,7 @@ module RUST-EXECUTION-TEST buildTestMethodCall( TraitName:TypePath, MethodName:Identifier, - Args:NormalizedCallParams, + Args:PtrList, 0 ) => normalizedMethodCall(TraitName, MethodName, Args)