SKETCH IN PROGRESS. DO NOT EXPECT THAT MUCH.
esotope IL is a group of intermediate languages defined for each esolang classes. They forms a common ground for interpretation, compilation and analysis: for example, Kipple and Aheui is very similar that we can use multiple stacks and sequential code flow, despite the latter is two-dimensional (albeit not self-modifying). Not to mention various Brainfuck derivates.
Esotope IL is a big S-expression, which is very similar to (actually, a subset of) Scheme lexical syntax. It is of the form:
(esotope-il (requires <requirements>) (class <class> <params> ...) (meta <metadata>) (defines (<name> <kind> <params>) ...) )
<requirements> specify what is required for the implementation to process this IL, and might be entirely removed. It is a combination of the following elements:
(version <version>): A minimal version required for this IL. The current version of esotpoe IL is 0, and IL is assumed to be version 0 if omitted.
(bits <bits>): The number of bits in the largest integer type used in this IL.
infinitywhich signals the use of arbitrary precision integer type. Note that this is different from the actual type; it is required, for example, when the IL refers to integer constants larger than 232. If omitted, the implementation is free to use any integer type (that makes sense, of course).
<class> denotes the class of esolang used. It is mandatory, and the first element of it is one of the following classes:
stack-sequential: Uses stacks as a memory and supports structured sequential constructs.
tape-sequential: Uses bidirectional tapes as a memory and supports structured sequential constructs.
Other elements are parameters specific to given class.
<metadata> is any data that doesn’t affect the actual processing. It may affect the error message or some, though. You can use any well-formed S-expression in it, and currently the following expressions are assigned the definite meaning:
(generator <generator>): The program that generated this IL.
<generator>is typically one string.
(source <file>): The path to the original source code.
(defines ...) specifies the common definitions and routines throughout the IL. It accepts the list of name-value pairs, and the definition or routine would be assigned to the name. Names should be unique. The name
main is reserved for an entry point of the program.
The following types are supported in the esotope IL:
(unsigned-integer N): An unsigned integer type with N bits. Can represent numbers from 0 to 2N–1. Supports arithmetic operations (overflows ignored) and bitwise operations.
(signed-integer N): A signed integer type with N bits. Can represent numbers from –2-(N–1) to 2N–1–1. Supports arithmetic operations (overflows ignored) and bitwise operations.
(bit): A boolean type. Can be thought as a synonym of
(unsigned-integer 1), but it doesn’t support arithmetic operations.
Classes, as defined in esotope IL, are used to group several esolangs into common representation. It is possible to convert some class to other class, but it might not be trivial.
This class of languages has one or more stacks, some of which may be defined to have reversed pop (conventionally called “queue”). This class has the following parameters: