Talk:CLC-INTERCAL

From Esolang
Jump to navigation Jump to search

I admit that I was the person responsible for incorporating some CLC-INTERCAL features into C-INTERCAL (specifically computed COME FROM). It's a pity the languages aren't more compatible, really. ais523 15:04, 22 Aug 2006 (UTC)

They could be made more compatible - after all CLC-INTERCAL (or SICK as it's called nowadays) has a C-INTERCAL compatibility mode; I just haven't added the new features since C-INTERCAL 0.22 or something like that. But it's all in the TODO list. Uilebheist 17:32, 22 Aug 2006 (UTC)

Looping Module

I made a new while loop opcode using the new 2023 extension system. You could argue that this violates the philosophy of INTERCAL, but I actually made this for the compiler system. The issue is that labels can't exist in the middle of multi-opcode statements, and also would have no way to differentiate between multiple instances of the statement without including the label in the syntax. This extension allows the creation of custom statements that require looping, without having to put it in the INTERCAL program as a lecture or something like that.

The opcode is 50/LOP, and accepts an expression, a count n, and n statement opcodes. It runs the expression, if zero, stop the loop, if non-zero, run the statements and repeat this sentence. Note that these can be nested, and that the inner statements cannot have labels, double-oh-seven execution, initial abstained status, ONCE, or AGAIN.

A few tips:

  • A condition that always evaluates to zero the second time (such as a variable that the body sets to zero) (but not necessarily the first time) functions as an if-statement.
  • A condition that is non-zero the first time and zero the second time is a way to group statements into one (for events or WHILE multithreading, which require a single statement)

You can load this extension with a .iacc file like this:

DO ?TYPE <- ?EXTENSION
DO ?LOAD_Looping <- ?LOOPING_MODULE
DO CREATE _2 ?BYTECODE ,LOP,=1 AS :50
DO GIVE UP

The extension is here. Insert it in one of the Perl @INC directories as Language/INTERCAL/Looping/Extend.pm.

BoundedBeans (talk) 05:51, 1 January 2024 (UTC)

One other thing about this extension. I coded it before I found out that the opcodes UNA, UNS, and UNE could have [[INT]] and [[TP]] to get the interpreter and thread pointer, so there's a callback that puts the interpreter in a static variable so that those opcodes could obtain it (and just try to guess the thread). That's why there's a weird bit of unnecessary callback code in this extension. BoundedBeans (talk) 06:55, 1 January 2024 (UTC)

UTF-8

CLC-INTERCAL seems to not support UTF-8, but it actually does. You just need to write a compiler using the bytes that make up the characters, and tell the compiler the program is in ASCII.

Here's a compiler that allows usage of a pop tart () instead of a spot as a register sigil:

DO ?TYPE <- ?EXTENSION
DO CREATE _2 ?RTYPE ,#226 + #140 + #186, AS SPO
DO GIVE UP

Here's a program that uses it and prints XV without any errors:

DO ⌺1 <- #15
DO READ OUT ⌺1
DO GIVE UP

BoundedBeans (talk) 00:11, 3 February 2024 (UTC)