Hello, World! in INTERCAL

Example for versions CLC-INTERCAL 1.-94.-2

CLC-INTERCAL Baudot-based text I/O mechanism differs from C-INTERCAL’s, but is not much more convenient. Baudot is a 5-bit character encoding, in which each character consists of two codes — shift state and the actual character code. Shift state can be 1..4, and switching between shift states takes special codes 31 (switch from 1|2 to 2 or from 3|4 to 1) and 27 (switch from 1|2 to 3 or from 3|4 to 4). Thus, an array which has to be printed is interpreted as a sequence of codes, each of them being either switch code or print-character code. The array is usually longer than the message, since switch codes are added.

In this example, the message starts with H, which corresponds to Baudot code “1 0x14” (shift state = 1, code = 20). Initially shift state is set to 1, no need to change it, and so the first element of the array is print-character code 20. Next character is e, Baudot “2 0x01”, we have to switch to state 2 (code 31) and print the character (code 1). Next is l, Baudot “2 0x13”, no shift state switching, only print character (code 19), etc.

Note that CLC-INTERCAL doesn’t really care about programmer’s politeness; the example contains much less PLEASE than C-INTERCAL would have required.

DO ,1 <- #18

DO ,1 SUB #1 <- #20
DO ,1 SUB #2 <- #31
DO ,1 SUB #3 <- #1
DO ,1 SUB #4 <- #19
DO ,1 SUB #5 <- #19
DO ,1 SUB #6 <- #24
DO ,1 SUB #7 <- #27
DO ,1 SUB #8 <- #12
DO ,1 SUB #9 <- #4
DO ,1 SUB #10 <- #31
DO ,1 SUB #11 <- #18
DO ,1 SUB #12 <- #31
DO ,1 SUB #13 <- #24
DO ,1 SUB #14 <- #10
DO ,1 SUB #15 <- #19
DO ,1 SUB #16 <- #9
DO ,1 SUB #17 <- #27
DO ,1 SUB #18 <- #13

PLEASE READ OUT ,1
PLEASE GIVE UP