diff --git a/ukm-semantics/main/decoding.md b/ukm-semantics/main/decoding.md index 3561da2..8d41757 100644 --- a/ukm-semantics/main/decoding.md +++ b/ukm-semantics/main/decoding.md @@ -1,8 +1,10 @@ ```k +requires "decoding/impl.md" requires "decoding/syntax.md" module UKM-DECODING + imports private UKM-DECODING-IMPL endmodule ``` diff --git a/ukm-semantics/main/decoding/impl.md b/ukm-semantics/main/decoding/impl.md new file mode 100644 index 0000000..631bbe6 --- /dev/null +++ b/ukm-semantics/main/decoding/impl.md @@ -0,0 +1,16 @@ +```k + +module UKM-DECODING-IMPL + imports private COMMON-K-CELL + imports private UKM-DECODING-SYNTAX + imports private UKM-FULL-PREPROCESSED-CONFIGURATION + + syntax UkmFullPreprocessedCell ::= decodeUkmFullPreprocessedCell(Bytes) + [function, hook(ULM.decode)] + + rule + ukmDecodePreprocessedCell(B:Bytes) => .K ... + (_:UkmFullPreprocessedCell => decodeUkmFullPreprocessedCell(B)) +endmodule + +``` diff --git a/ukm-semantics/main/encoding.md b/ukm-semantics/main/encoding.md index 60ba0de..bac22d1 100644 --- a/ukm-semantics/main/encoding.md +++ b/ukm-semantics/main/encoding.md @@ -4,7 +4,8 @@ requires "encoding/syntax.md" requires "encoding/encoder.md" module UKM-ENCODING - imports UKM-CALLDATA-ENCODER + imports private UKM-CALLDATA-ENCODER + imports private UKM-ENCODING-IMPL endmodule ``` diff --git a/ukm-semantics/main/encoding/impl.md b/ukm-semantics/main/encoding/impl.md new file mode 100644 index 0000000..d0f10b0 --- /dev/null +++ b/ukm-semantics/main/encoding/impl.md @@ -0,0 +1,22 @@ +```k + +module UKM-ENCODING-IMPL + imports private COMMON-K-CELL + imports private BYTES-SYNTAX + imports private UKM-ENCODING-SYNTAX + imports private UKM-FULL-PREPROCESSED-CONFIGURATION + + syntax Bytes ::= encodeUkmFullPreprocessedCell(UkmFullPreprocessedCell) + [function, hook(ULM.encode)] + + rule + + ukmEncodePreprocessedCell + => ukmEncodedPreprocessedCell(encodeUkmFullPreprocessedCell(Cell)) + ... + + Cell:UkmFullPreprocessedCell + +endmodule + +``` diff --git a/ukm-semantics/main/encoding/syntax.md b/ukm-semantics/main/encoding/syntax.md index 2fb33bb..6be1457 100644 --- a/ukm-semantics/main/encoding/syntax.md +++ b/ukm-semantics/main/encoding/syntax.md @@ -6,6 +6,7 @@ module UKM-ENCODING-SYNTAX imports RUST-REPRESENTATION syntax UKMInstruction ::= "ukmEncodePreprocessedCell" + | ukmEncodedPreprocessedCell(Bytes) syntax Bytes ::= encodeCallData (String, List, List) [function] //Function name, argument types, argument list | encodeFunctionSignature (String, List) [function]