Skip to content

Commit 96d7b64

Browse files
dwightguthrv-jenkins
authored andcommitted
make ByteArray a synonym and remove casts (#520)
1 parent 9d5fc0c commit 96d7b64

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

asm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Operator `#revOps` can be used to reverse a program.
4545
// ------------------------------------------------------------------------------------------
4646
rule #asmOpCodes( OPS ) => #asmOpCodes(#revOps(OPS), .ByteArray)
4747
48-
rule #asmOpCodes( PUSH(N, W) ; OCS, WS ) => #asmOpCodes(OCS, #asmOpCode(PUSH(N)) : {#padToWidth(N, #asByteStack(W)) ++ WS}:>WordStack)
48+
rule #asmOpCodes( PUSH(N, W) ; OCS, WS ) => #asmOpCodes(OCS, #asmOpCode(PUSH(N)) : (#padToWidth(N, #asByteStack(W)) ++ WS))
4949
rule #asmOpCodes( OP ; OCS, WS ) => #asmOpCodes(OCS, #asmOpCode(OP) : WS) requires PUSH(_, _) :/=K OP
5050
rule #asmOpCodes( .OpCodes, WS ) => WS
5151
```

data.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,8 @@ The local memory of execution is a byte-array (instead of a word-array).
502502
- `#padToWidth(N, WS)` and `#padRightToWidth` make sure that a `WordStack` is the correct size.
503503

504504
```{.k .concrete}
505-
syntax ByteArray ::= Bytes
506-
| ".ByteArray" [function]
505+
syntax ByteArray = Bytes
506+
syntax ByteArray ::= ".ByteArray" [function]
507507
// --------------------------------------------
508508
rule .ByteArray => .Bytes
509509
@@ -543,8 +543,8 @@ The local memory of execution is a byte-array (instead of a word-array).
543543
```
544544

545545
```{.k .symbolic}
546-
syntax ByteArray ::= WordStack
547-
| ".ByteArray" [function]
546+
syntax ByteArray = WordStack
547+
syntax ByteArray ::= ".ByteArray" [function]
548548
// --------------------------------------------
549549
rule .ByteArray => .WordStack
550550
@@ -575,7 +575,7 @@ The local memory of execution is a byte-array (instead of a word-array).
575575
syntax ByteArray ::= ByteArray "++" ByteArray [function, memo, right, klabel(_++_WS), smtlib(_plusWS_)]
576576
// -------------------------------------------------------------------------------------------------------
577577
rule .WordStack ++ WS' => WS'
578-
rule (W : WS) ++ WS' => W : {WS ++ WS'}:>WordStack
578+
rule (W : WS) ++ WS' => W : (WS ++ WS')
579579
580580
syntax ByteArray ::= ByteArray "[" Int ".." Int "]" [function, functional, memo]
581581
// --------------------------------------------------------------------------------
@@ -788,7 +788,7 @@ These parsers can interperet hex-encoded strings as `Int`s, `ByteArray`s, and `M
788788
// -------------------------------------------------------------
789789
rule #parseByteStack(S) => #parseHexBytes(replaceAll(S, "0x", ""))
790790
rule #parseHexBytes("") => .ByteArray
791-
rule #parseHexBytes(S) => Int2Bytes(1, #parseHexWord(substrString(S, 0, 2)), BE) +Bytes {#parseHexBytes(substrString(S, 2, lengthString(S)))}:>Bytes requires lengthString(S) >=Int 2
791+
rule #parseHexBytes(S) => Int2Bytes(1, #parseHexWord(substrString(S, 0, 2)), BE) +Bytes #parseHexBytes(substrString(S, 2, lengthString(S))) requires lengthString(S) >=Int 2
792792
793793
rule #parseByteStackRaw(S) => String2Bytes(S)
794794
```
@@ -800,9 +800,9 @@ These parsers can interperet hex-encoded strings as `Int`s, `ByteArray`s, and `M
800800
// -------------------------------------------------------------
801801
rule #parseByteStack(S) => #parseHexBytes(replaceAll(S, "0x", ""))
802802
rule #parseHexBytes("") => .WordStack
803-
rule #parseHexBytes(S) => #parseHexWord(substrString(S, 0, 2)) : {#parseHexBytes(substrString(S, 2, lengthString(S)))}:>WordStack requires lengthString(S) >=Int 2
803+
rule #parseHexBytes(S) => #parseHexWord(substrString(S, 0, 2)) : #parseHexBytes(substrString(S, 2, lengthString(S))) requires lengthString(S) >=Int 2
804804
805-
rule #parseByteStackRaw(S) => ordChar(substrString(S, 0, 1)) : {#parseByteStackRaw(substrString(S, 1, lengthString(S)))}:>WordStack requires lengthString(S) >=Int 1
805+
rule #parseByteStackRaw(S) => ordChar(substrString(S, 0, 1)) : #parseByteStackRaw(substrString(S, 1, lengthString(S))) requires lengthString(S) >=Int 1
806806
rule #parseByteStackRaw("") => .WordStack
807807
```
808808

0 commit comments

Comments
 (0)