# Enwokenment

Paradigm(s) | String rewriting |
---|---|

Designed by | User:Hakerh400 |

Appeared in | 2024 |

Computational class | Turing complete |

Major implementations | Implemented |

File extension(s) | `.txt` |

**Enwokenment** is an esolang invented by User:Hakerh400 in 2024.

## Overview

Term consists of a variable name and its integer coefficient. Example: `2x`

Expression is a sum of terms. Example: `3x - 4y + z`

Source code consists of one or more expressions. Input and output are expressions with all positive coefficients.

When program starts, the input is the main expression. The interpreter finds the first expression that, when added to the main expression, results in an expression with all positive coefficients. The sum of the two expressions is the new expression and the interpreter starts the search from the first expression again. If no such expression can be found, the program halts and the main expression becomes the output. Variable `_`

(underscore), if present, gets removed from the output.

## Example

This program multiplies the coefficients of `x`

and `y`

and stores the product in the coefficient of `z`

. For instance, if the input is `5x + 7y`

, the output will be `35z`

.

c - a - y a + b + z - c _ - a y - b a - x _ - y

## Computational class

Enwokenment can almost directly implement FRACTRAN (each prime factor of the numerator and denominator in FRACTRAN maps to a variable in Enwokenment, with the multiplicity of the factor mapping to the coefficient); the only difference is that FRACTRAN allows a factor to exist in both the numerator and denominator, whereas Enwokenment only allows one or the other. However, this restriction is trivial to work around: if the translation of the FRACTRAN would require both a positive and negative coefficient for the same variable (e.g. if 2 maps to `x`

, 8/64 should map to `- 6x + 3x`

but this would not work because the -6 and 3 would add together), the positive coefficient can be replaced with a new variable (e.g. `3y - 6x`

), and an extra line added to move that variable's value back into the original variable's value (in this example, `x - y`

). Because FRACTRAN is Turing-complete, so is Enwokenment.