CLC-INTERCAL Reference

... Fundamental Concepts

Table of contents:

History of INTERCAL

This section will be left blank until somebody volunteers to write it.

INTERCAL Syntax

INTERCAL enjoys a very simple and regular syntax. The input file is completely free format. The whole program can bein one (very long) line, or a newline can be inserted anywhere a space is permitted. There is no need for a special statement termination symbol (like the hybrid (;) used by C, Perl, Java, and other languages). Instead, a statement simply ends when the next one starts.

Whitespace is allowed almost anywhere. The only exception is inside keywords (so IGNORE cannot be written IG NORE) and numbers (so #65535 is not the same as #655 35). However, if a keyword already contains a space (like COME FROM), more can be added to keep it company, or the lone space can be removed.

Note that a future version of CLC-INTERCAL plans to embed a Whitespace compiler inside the standard compiler. When that is done, whitespace will be still ignored by the standard compiler, but it will have a new meaning. We'll change this chapter as necessary when we do that.

A statement consists of up to five fields; only the second and fifth are required, the rest being optional. When the compiler is looking for the start of a statement, it will look for anything which resembles the contents of the first or the second field and take it from there. The five fields are:

For example, all the following statements are equivalent when executed:

As an aside, the above is a useful "no operation" statement which you might want to know about. It does nothing, so it can't do any more damage than the rest of the program already does. It can be REINSTATEd, though, so you might end up executing it which will print DON'T PANIC on the terminal and exit - this might also be useful.