From Esolang
Jump to: navigation, search


Symesol, short for SYMbol ESOteric Language, is an esoteric programming language by Abraham Karplus. Its most striking feature is using symbols for variable names and letters for operations. It is Turing complete. Symesol is generally easier to program in than to read, particularly if variable names are deliberately chosen to mislead. I am currently working on a Symesol compiler in Python. Symesol files have the extension sye. Compiled (Python) files have the extension syx. All errors are fatal. It is also a fatal error to have any not understood characters (e.g. capital letters or non-ASCII characters).



There are three types of variables: reals (with subtype integers), functions, and arrays. Arrays can contain any of the types, even subarrays. It is an error to treat any type as another type. Reals do not need to be explicitly declared before use, but arrays must be initialized with the y operation (see "Basic Operations" below). Defining and using functions requires special syntax (see "Functions" below).


Variable names are formed from the characters !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ combined in any order, as alphanumerics would be in most programming languages. It is conventional for the first character of a variable name to reflect something about the variable: : for functions, $ for parameters, # for arrays, ~ for loop indices, % for representations of characters, ? for booleans (integers 0 and 1), = for results of comparison, . for included content, _ for hidden variables in included files, and ` for highly temporary variables.


The only type of allowed literal is the integer, which is written in base 10 with the digits 0123456789 as normal. There is no way of representing a negative or non-integer number as a literal, but an integer stored in a variable can be modified to a non-integer with the arithmetic operations (see "Basic Operations" below).

Characters and Strings

Characters are represented as integers using the Unicode codepoints. String can be done as arrays of these integers, though output is only single character at a time. As per ASCII, end-of-file has value 4, and newline has value 10.


A comment is begun at any point with the space character, and continues until terminated by the newline character. Any characters other than newline may safely appear within the comment. The newline character has only one other use (see "Includes" below), and so may safely be used as a separator.


Another Symesol file may be included into the current one with the q syntax. After the q, all characters until a newline are treated as the name as the file to include. Included code is inserted at compile time.

Basic Operations

All variable names used in this section are placeholders. The ! and ~ placeholders used in this section may be replaced by literals, but all others must be actual variables.


  • a add

Increases the real in @ by the real !.

  • m multiply

Multiplies the real in @ by the real !.

  • n negate

Negates (multiplies by negative one) the real in @.

  • v inverse

Takes the multiplicative inverse (one over) of the real in @.


  • i input

Stores the Unicode value of the next inputted character in @.

  • o output

Prints out the character corresponding to the Unicode value !.


Arrays have a fixed length set at array initialization that cannot be changed. Attempting to read or write outside this range is an error. Reading a value in an array if that value has not yet been written is an error. Array indices go from 0 to the length of the array minus 1.

  • h length

Stores the length of array # in the real @.

  • r read

Stores the value at position ~ of array # in @.

  • w write

Stores the value ! in position ~ of array #.

  • y initialize

Defines the variable # to be an array of length !. Any former value in the variable # is overwritten.


  • c compare

Stores the result of the comparison between ! and = in =. The result is 1 if ! is larger, 0 if they are equal, and -1 if = is larger.

  • j not

Stores 0 in @ if it is non-zero, 1 otherwise.

  • s store

Stores the value of ! in the variable @. This will copy the value, even for arrays.

  • x return

Returns the value ! from the function. See "Functions" below. If doubled to xx, exits the program.

Control Flow

The variable ? is here a placeholder.


A conditional, or "if-statement", has the format f?t[body]z. If the real ? is true (non-zero), the body is executed. Otherwise, the entire conditional is skipped.


A loop has the form l[body]z. The body is repeatedly executed until a break statement b, usually inside a conditional, is encountered, at which point the loop exits. A loop inside a function will also stop if the function returns from inside the loop.


The variable names in this section are placeholders.


The define statement d has the format d:[parameters][locals]g[body]z. The variable name : is the name of the function. Parameters are zero or more statements of the form p$, specifying an argument to the function referenced internally as e.g. $. The body of the function is run whenever the function is called. The return operation x must be used because it is an error to encounter the end of the function while executing it. Functions are defined at run time. Any variables referenced in the function that are not parameters or defined in the function are evaluated at definition time.


A function : is called using the use statement u. It has the format u:u@[parameters], where : is the name of the function, @ is where its return value should be stored, and parameters is zero or more (depending on how many arguments the function takes) statements of the form p$, where $ is a value to pass to the function. All arguments are pass-by-value.


The variable names in this section are not placeholders.

Copies input to output


Copies input to output, incrementing character values by 1


Copies input (max 1000 chars.) into an array then outputs the array


Prints "Hello world!" followed by a newline


Defines a function to check for EOF and uses it in copying input to output