X-Git-Url: http://git.subgeniuskitty.com/vvhitespace/.git/blobdiff_plain/3e7318181b224315b471f85c0ab9a8f73471075b..e5d2b9bf5614e1674ebe47db7b7f1076e85c1bd5:/rationale.md diff --git a/rationale.md b/rationale.md index 2499caa..c847fab 100644 --- a/rationale.md +++ b/rationale.md @@ -17,7 +17,8 @@ which can be visually regrouped as SSSSNSN NSSSTSTTTSN -and contains the `MARK label0` command used in the next set of examples. +and contains the `MARK label0` command (i.e. `NSSSTSTTTSN`) used in the next +set of examples. Additionally, since `PUSH 0; DROP` is effectively a `NOP`, 'hijacking' the code at this location allows one to insert their own integer on the stack in place @@ -30,45 +31,49 @@ discovering that they broke down into two methods for locating labels. * **Method 1** Scan from the start of the file for the first occurence of the mark-label bytestring and jump. - Example: whitespacers/c: (c) meth0dz + Examples: + + whitespacers/c: (c) meth0dz * **Method 2** Scan from the start of the file, looking for a mark-label bytestring, but 'parsing' one bytestring at a time, and jumping to the first 'standalone' mark-label bytestring. Note that this is different than executing the program, particularly when user-input commands are present. - Example: whitespacers/haskell: (c) 2003 Edwin Brady - whitespacers/ruby: (c) 2003 by Wayne E. Conrad - whitespacers/perl: (c) 2003 Micheal Koelbl - threeifbywhiskey/satan + Examples: + + whitespacers/haskell: (c) 2003 Edwin Brady + whitespacers/ruby: (c) 2003 by Wayne E. Conrad + whitespacers/perl: (c) 2003 Micheal Koelbl + threeifbywhiskey/satan Both of these methods can be broken using valid Whitespace code: - * Type A: No 'standalone' label exists. This breaks Method 2. + * **Type A**: No 'standalone' label exists. This breaks Method 2. - By programmer's intent, this should print a '!' before infinite '.' lines. + By programmer's intent, this should print a `!` before infinite `.` lines. - * Type B: Hidden label before 'standalone' label. This breaks Method 1. + * **Type B**: Hidden label before 'standalone' label. This breaks Method 1. - By programmer's intent, this should print an infinite chain of '.' lines. + By programmer's intent, this should print an infinite chain of `.` lines. This is the Type A program: - SSSTSSSSTN | Push +33 (ASCII !) - NSNSTSTTTSN | JMP>label0 - NSSTTTTN | MARK label2 - SSSSN | PUSH +0 + SSSTSSSSTN | Push +33 (ASCII '!') + NSNSTSTTTSN | JMP > 0101110 (label0) + NSSTTTTN | MARK: 1111 (label2) + SSSSN | PUSH 0 SNN | DROP - SSSTSTTTSN | Push +46 (ASCII .) + SSSTSTTTSN | Push +46 (ASCII '.') TNSS | Output character - SSSTSTSN | Push +10 (ASCII newline) + SSSTSTSN | Push +10 (ASCII '\n') TNSS | Output character - NSNTTTTN | JMP>label2 + NSNTTTTN | JMP > 1111 (label2) Append this to turn it into the Type B program: - NSSSTSTTTSN | MARK label0 (2nd time) - NSNTTTTN | JMP>label2 + NSSSTSTTTSN | MARK: 0101110 (label0) (2nd time) + NSNTTTTN | JMP > 1111 (label2) VVhitespace avoids this ambiguity by marking label definitions with a vertical tab `[VTab]` immediately before the label.