# CLC-INTERCAL Reference

## ... Fundamental Concepts

Table of contents:

- Parent directory
- History of INTERCAL
- INTERCAL Syntax

## 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 be in 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:

- Label - this is a number enclosed in parentheses, for example (1) or (65535). The number must be a positive integer less than 65536. Recent versions of CLC-INTERCAL allow computed labels if you specify the computed-labels compiler option: in this case any valid expression enclosed in parentheses and immediately preceding a statement identifier will count as a label.
- Statement identifier - this is one of the keywords "DO", "PLEASE", or "PLEASE DO". The programmer should achieve a good balance between these keywords, as otherwise the compiler will stop with an error. We recommend approximately one "PLEASE" every four statements. Note that CLC-INTERCAL does not currently check for a balance between politeness and rudeness, although it will one day.
- Initial ABSTAIN - this is one of the keywords "NOT" or "N'T", or `¬` (this is the symbol for logical negation, if the character set is ISO-8859-1 or UTF-8). See the discussion on ABSTAIN FROM in the chapter about Statements.
- Execution probability - this is the symbol double-oh-seven (`%`) followed by an expression. Before executing the statement, the value is calculated: if it is 100 or over, the statement is executed. Otherwise, the statement might or might not be executed, and the probability of executing it is the value of the expression. For compatibility with INTERCAL-72, which only accepted constant probabilities, constants can be written without the leading "#", i.e. "%#50" can be written simply "%50".
- Statement - this is described in the chapter about Statements, and can be composed of several subfields.

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

    	DON'T PANIC
    	PLEASE DO NOT PANIC
    	PLEASE ¬ PANIC
    	DO¬PANIC
    	DONOTPANIC

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.

Another common example of a "no operation" statement is:

    	DON'T GIVE UP

Unlike the previous example, this one cannot be reinstated, so il will always be a very safe statement to execute.