We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

FROM HERE TO THERE

From Esolang
Jump to navigation Jump to search

FROM HERE TO THERE is an esolang by User:PythonshellDebugwindow.

Syntax

Lines can be separated by \n, \r\n, \n , \r\n , ;, ; , ;\n, or ;\r\n where \r is CR and \n is LF, but \n is used on this page for consistency. Each line has the following syntax:

FROM x TO y

x can be LINE, IN, a file, an integer, a string, or a variable, and y can be anything x can (minus IN) as well as OUT, ERR, and a variable expression (a binary math operator and its operands).

Values of y

Value of y Effect
LINE Unconditionally jump to 0-indexed line x
OUT Output x with a newline to STDOUT
ERR Output x with a newline to STDERR
A file Write x to file y without a newline
An integer For every defined variable V: if V is equal to x, set it to y
A string Same as if y is an integer
A variable Set the variable named y to x (initialize it if necessary)
A variable expression For LHS (OP) RHS, set the variable named LHS to its offset for x (please see #Variables)

Special values of x

If x is equal to IN, then replace it with a line of user input read from STDIN as a string before executing the rest of the line. If it is equal to LINE, then replace it with the current 0-indexed line number.

Variables

FROM HERE TO THERE uses a reverse-operation notation to perform math on variables; standalone math is illegal. To create a variable myVar and set it to 20:

FROM 20 TO myVar

To increment it by n:

FROM myVar TO myVar - n

To decrement it by n:

FROM myVar TO myVar + n

To multiply it by n:

FROM myVar TO myVar / n

To divide it by n:

FROM myVar TO myVar * n

Literals

Type Example
File <path/to/file.txt>
Integer 123
String "Hello, World!"
Variable myVar

BNF

<program> ::= <line> ( <endl> <line> )*
<line>    ::= "FROM" " "+ <from> " "+ "TO" " "+ <to>
<from>    ::= "LINE" | "IN" | <file> | <int> | <str> | <id>
<to>      ::= "LINE" | "OUT" | "ERR" | <file> | <int> | <str> | <id> | <varexpr>
<file>    ::= "<" ( "~" | "." | <id> ) ( "/" <id> )* ( "." <id> )* ">"
<int>     ::= DIGIT DIGIT*
<str>     ::= "\"" ANY* "\""
<varexpr> ::= <id> " "? ( "+" | "-" | "*" | "/" ) " "? ( <id> | <int> )
<id>      ::= LETTER-UPPER | LETTER-LOWER | "_" | id id
<newline> ::= ( "\r" | "\r\n" ) ( "\r" | "\r\n" )*
<endl>    ::= ( ";" " "? | ";" <newline> | <newline> )

Examples

Hello, World!

FROM "Hello, World!" TO OUT

Infinite cat

FROM IN TO OUT
FROM 0 TO LINE

Truth-machine

FROM IN TO n
FROM "0" TO 6
FROM "1" TO 4
FROM n TO LINE
FROM 1 TO OUT
FROM 4 TO LINE
FROM 0 TO OUT

Variable operations

This program creates a variable, initializes it to 7, sets it to 19, increments it, then divides it by 4 and prints its value.

FROM 7 TO myVar
FROM 19 TO myVar
FROM myVar TO myVar - 1
FROM myVar TO myVar * 4
FROM myVar TO OUT

Computational class

FROM HERE TO THERE’s computational class is unknown.

See also

External links