Phile is an esolang by User:PythonshellDebugwindow. Its name is a play-on-words of the word "phile" and the word "file", a major part of the language.
Each line in Phile is one of the following:
OPEN fname; WRITE fname value; OVERWRITE fname value; CLOSE fname; value? line-number;
If a line begins with
OPEN, then that fname will be set as a current file (it will be created if it doesn't already exist).
If it starts with
CLOSE, then that fname will be removed as a current file; it is an error if you don't close an opened file by the end of the program.
If it starts with
WRITE, then value will be written to fname without overwriting it.
And if it starts with
OVERWRITE, then value will be written to fname, overwriting any previous contents.
value? line-number; is a conditional jump; if value is not one of "", "0", or 0, then the instruction pointer will jump to 0-based line-number.
Comments are denoted by
/// and last until end-of-line.
READ fname instruction can be used to read a line from fname (until newline or EOF). If a READ, WRITE, or CLOSE instruction attempts to operate on an fname that isn't a current file, or if the OPEN instruction tries to open a file that is a current file, then an error will be thrown.
Datatypes are string and signed integer, both arbitrary-length. Integer literals are base 10.
0 + string is string-to-integer conversion,
"" + number is integer-to-string conversion. String escape sequences are
\" \n \\ \t,
\n can be
Math and Comparison (operators)
A OP B can be used for math and comparison. Where OP is one of
+-*/, then it will perform that operation on A and B and return the result. Where OP is one of
=! (= → equality, ! → inequality, < → less than, > → greater than), then it will return A (OP) B. Otherwise, it is invalid syntax. Precedence is as follows, with first listed being highest:
*/+-=!, READ has the highest precedence, + is used for addition, concatenation, and conversion (see #Datatypes).
stderr.stream represent STDIN, STDOUT, and STDERR respectively. It is an error to write to STDIN or to read from STDOUT or STDERR.
OPEN "stdout.stream"; WRITE "stdout.stream" "Hello, World!"; CLOSE "stdout.stream";
OPEN "stdin.stream"; OPEN "stdout.stream"; WRITE "stdout.stream" READ "stdin.stream"; 1? 2;
OPEN "stdin.stream"; OPEN "stdout.stream"; READ "stdin.stream" = 0? 5; WRITE "stdout.stream" 1; 1? 3; WRITE "stdout.stream" 0; CLOSE "stdin.stream"; CLOSE "stdout.stream";
Using the OPEN command for initialization, the READ command for getting its value, and the OVERWRITE command for setting its value, a file can be used as a variable. Any amount of files can be open at one time, and you can therefore have any amount of variables.