On this page:
5.1 Reader and frontend
5.2 Statements and modifiers
5.3 Expressions and data
5.4 I/  O
5.5 Libraries

5 What is implemented🔗ℹ

The current implementation covers the main language pipeline and a large amount of INTERCAL semantics.

5.1 Reader and frontend🔗ℹ

The frontend is split across four files:

  • "intercal.rkt": reader entrypoint that produces a Racket module and exports intercal-main.

  • "ick-lexer.rkt": tokenization and packed-SUB preprocessing.

  • "ick-bnf.rkt": brag grammar for INTERCAL statements and expressions.

  • "ick-normalize.rkt": conversion from brag parse trees to the normalized S-expression representation used by the macro backend.

The reader also shares the cleaning logic in "sick.rkt" to:

  • merge continuation lines.

  • discard prose/commentary lines that are not parseable statements.

  • preserve upstream-style prefixes like DONT and wrapped expressions.

5.2 Statements and modifiers🔗ℹ

This implementation supports:

  • assignment, including BY-dimensioned arrays.

  • NEXT, RESUME, FORGET, and COME FROM.

  • READ OUT and WRITE IN.

  • STASH, RETRIEVE, IGNORE, and REMEMBER.

  • ABSTAIN and REINSTATE, including gerund lists.

  • TRY AGAIN, GIVE UP, and NOTHING.

  • prefix modifiers such as PLEASE, DO, NOT, and chance execution.

  • postfix state modifiers ONCE and AGAIN.

Gerund-based abstention is implemented with counted abstention state, so multiple layers of abstention compose properly and a later reinstate removes one layer at a time.

5.3 Expressions and data🔗ℹ

The expression language includes:

  • onespot and twospot constants.

  • onespot, twospot, tail, and hybrid variables.

  • MINGLE, SELECT, and unary binary operators.

  • quote-based grouping.

  • packed and nested SUB expressions.

  • multidimensional arrays with runtime bounds checking.

The runtime enforces onespot/twospot width limits and raises the appropriate INTERCAL errors when a value does not fit.

5.4 I/O🔗ℹ

Scalar I/O uses the standard numeric INTERCAL spelling and Roman numeral output. Array I/O uses the C-INTERCAL tape encoding, which is necessary for real programs such as "pit/hello.i" and "pit/unlambda.i".

5.5 Libraries🔗ℹ

The macro frontend loads "syslib.i" automatically and pulls in additional libraries such as "pit/floatlib.i" when label references require them. Library inclusion is based on referenced labels, not on raw numeric constants, to avoid spurious loads.