EOF

From Esolang
Jump to navigation Jump to search

EOF is a symbol indicating the end of a file. Since a source file is finite in length, EOF is the last symbol in most source files of esoteric languages, though this symbol usually isn't mentioned in the specification.

For example, Brainfuck defines 8 commands. EOF can be considered a 9th command meaning "end the program", but it's left out of the specification.

Some languages do not need EOF. For instance, Unlambda and Iota always have one more function primitive than apply operator (` or *), so there are only as many symbols in those languages as mentioned in their specifications.

EOF as metadata

Many esoteric programming language enthusiasts argue that EOF is not a symbol, but merely one way of expressing the length of a file, which is metadata. Indeed, it is possible to implement esoteric programming language interpreters and compilers by checking the length of the source file before loading it, rather than testing for an EOF symbol.

There exist languages that don't have an EOF symbol, such as languages using an image as source code. There are also two-dimensional textual languages, which, if the logic that EOF is a symbol is accepted, surely have two extra symbols: EOF and newline. Metadataists point to this apparently absurd situation as evidence that EOF should not be treated as a symbol. Thus, 1L really has only two symbols, and Unary only one.