Added printf and stackrotate functions to VVS stdlib.
[vvhitespace] / rationale.md
CommitLineData
cbbb46ce
AT
1VVhitespace is descended from Whitespace, adding a vertical tab to the language
2along with some restrictions to ease implementation. The name is intended to
3embrace the spirit of Whitespace's visual incomprehensibility.
4
5Since Whitespace ignores [VTab] as a comment character, and since the
6Whitespace VM is a superset of the VVhitespace VM, all valid VVhitespace
7programs are also valid Whitespace programs.
8
eaba0660
AT
9--------------------------------------------------------------------------------
10
11TODO: Finish this up based on what I've found below.
12
13It seems that all (most?) WS interpreters locate labels using one of two methods.
14
15 * **Method 1** Scan from the start of the file for the first occurence of the
16 mark-label bytestring and jump.
17
18 * **Method 2** Scan from the start of the file, looking for a mark-label
19 bytestring, but 'parsing' one bytestring at a time, and jumping to the
20 first 'standalone' mark-label bytestring. Note that this is different than
21 executing the program, particularly when user-input commands are present.
22
23Both of these methods can be broken:
24
25 * Type 1: No 'standalone' label exists. This breaks Method 2.
26
27 This should print a '!' before infinite '.' lines.
28
29 * Type 2: Hidden label before 'standalone' label. This breaks Method 1.
30
31 This should print an infinite chain of '.' lines.
32
33This is the Type 1 program:
34
35 SSSTSSSSTN | Push +33 (ASCII !)
36 NSNSTSTTTSN | JMP>label0
37 NSSTTTTN | MARK label2
38 SSSSN | PUSH +0
39 SNN | DROP
40 SSSTSTTTSN | Push +46 (ASCII .)
41 TNSS | Output character
42 SSSTSTSN | Push +10 (ASCII newline)
43 TNSS | Output character
44 NSNTTTTN | JMP>label2
45
46Append this to turn it into the Type 2 program:
47
48 NSSSTSTTTSN | MARK label0 (2nd time)
49 NSNTTTTN | JMP>label2
50
51WS Interpreter Evaluations:
52
53 Method 1:
54 whitespacers/c: (c) meth0dz
55
56 Method 2:
57 whitespacers/ruby: (c) 2003 by Wayne E. Conrad
58 whitespacers/perl: (c) 2003 Micheal Koelbl
59 whitespacers/haskell: (c) 2003 Edwin Brady
fc2c8ac7 60 threeifbywhiskey/satan