Combientièm

Combientièm (from "combientième", the French word for "whichth", i.e. "which number in sequence") is an esoteric programming language inspired by Forth, created by Tanner Swett in 2013. A Combientièm program consists of a sequence of Unicode characters.

Semantics
A mode is either Interp or Comp.

A Combientièm interpreter has the following pieces of state. The mode flag is a mode, initially Interp. The dictionary consists of a map from (Unicode character, mode) pairs to strings, initially mapping every pair onto the empty string. The current definition pointer is a (Unicode character, mode) pair, initially (猫, Interp). Finally, the continuation is a string of Unicode characters, initially the entire program.

The current definition is the string that the dictionary maps the current definition pointer onto.

Each step of the program's execution consists of removing the first character from the continuation (or exiting, if the continuation is empty) and performing its interpretation semantics if the mode flag is Interp, or its compilation semantics if the mode flag is Comp.

For any Unicode character x, if the dictionary entry for (x, Interp) is a non-empty string, then x's interpretation semantics consist of prepending the string to the continuation. If the dictionary entry for (x, Comp) is a non-empty string, then x's compilation semantics consist of setting the mode flag to Interp, prepending R to the continuation, and then prepending the string to the continuation.

The following characters have the following semantics, unless their semantics are determined by the above paragraph:


 * N, interpretation semantics: remove the first character from the continuation (call it x), set the current definition pointer to (x, Interp), set the current definition to the empty string, and set the mode flag to Comp.
 * M, interpretation semantics: the same as above, except that the current definition pointer is set to (x, Comp).
 * R, interpretation semantics: set the mode flag to Comp.
 * D, compilation semantics: set the mode flag to Interp.
 * L, compilation semantics: remove the first character from the continuation and append it to the current definition.

For any Unicode character x, if x's interpretation semantics are not determined by any of the above, then the interpretation semantics of x consist of doing nothing. If x's compilation semantics are not determined by any of the above, then the compilation semantics consist of appending x to the current definition.

Computational class
Combientièm is probably Turing-complete or something.