Ixux
Jump to navigation
Jump to search
Ixux is an object-oriented esolang by User:BoundedBeans inspired by Unix/Linux commands.
Basic concepts
- A string is an arbitrary-length sequence of bytes. This may include null bytes, though they have limited support with commands.
- A file path usually means a real file, which may use Windows or Unix paths depending on the system. However, regardless of system, paths starting with
/usr/../
refer to local variables, paths of the format/bin/../[uppercase hex string or +]/[string without slash]/f
refer to a field access of an object (the hex string, or + for the current object) with field name (the other string). The path/bin/../G
refers to a special variable which will be returned from the method when it finishes. Paths named/bin/../H[DecimalNumber]
refer to zero-based parameters to a method. The path/bin/../I
contains the number of parameters represented as a decimal string. - Variables can be strings or objects. Objects are maps from slashless null-less strings to strings or further objects.
/dev/stdin
,/dev/stdout
, and/dev/stderr
automatically jump past the device files and directly print/input it, which means it won't require root permissions. - Variables that don't exist are equivalent to existing variables set to the empty string.
- Strings, including the above mentioned file paths, are always written in code as their uppercase hexadecimal representation enclosed in square brackets. Assume ANSI unless otherwise specified.
- The method @Init@ of class @StartClass@ will run first, passed the command line arguments.
Syntax
Ixux has significant whitespace, where each level should be exactly four spaces indented from the last.
A class is written like:
?CLASS? @ClassName@ ?METHOD? @MethodName@ *code* ?METHOD? @AnotherMethod@ *code*
A class must have a method named @Init@ that creates the object based on the parameters.
A special syntax exists for a line that activates on any line containing exactly three exclamation points.
Ignored!number of preceding spaces!line contents!ignored
For example:
A comment!8!{ECHO} [486921] => [2F7573722F2E2E2F610A]!Another comment
Equality semantics
- Strings are considered equal if they are the same length and encode an identical sequence of bytes.
- Two objects are equal if both have a method named @Equal@ which returns the string "1" when called with the other as the only parameter.
- An object is equal to a string if the object has a method called @EqualString@ which returns the string "1" when called with the string as the only parameter.
Commands
The only statement is the assignment statement, written as:
(Command) => (file path as hex string)
: @[MethodName]@ [ObjectPath] [ParameterPath]*
|
Calls a method on the object with parameters. |
. @[ClassName]@ [ParameterPath]*
|
Constructs an object with the @Init@ method. |
{ECHO} [Argument]*
|
Returns the arguments, separated by byte 32, followed by byte 10. If one of the arguments is "-n", it is ignored and byte 10 is not added to the end. |
{CAT} [Argument]*
|
Linux cat with support for -AbeEnstTuv. Does not support long options. Returns the output. |
{CUT} [Argument]*
|
Linux cut with support for -bcfds and --output-delimiter=string. Returns the output. |
{PASTE} [Argument]*
|
Linux paste with support for -d. Returns the output. |
{XXD} [Argument]*
|
Linux xxd with support for -abcEglprsu. Long options not supported. Returns output. |
{HEAD} [Argument]*
|
Linux head with support for -cn and negative numbers for the values of those options. |
{RM} [Argument]*
|
Linux rm with support for -rf. Long options and -R not supported. Returns output. |
^[FilePathHex]
|
Evaluates the contents of the file or variable as a line of code. |
| [CommandInNestableAngleBrackets]+
|
Makes a chain of piping outputs to inputs. Returns output of the final command. |
% [FilePath1] [FilePath2] ~[LabelName]~
|
If the two variables are equal, goto the command after the ~~ command with the same label name and return the empty string. Otherwise, just return the empty string. |
~[LabelName]~
|
Label placeholder, when encountered (such as by advancing from the previous command), return the empty string. |
Examples
Hello, world!
?CLASS? @StartClass@ ?METHOD? @Init@ {ECHO} [48656C6C6F2C20776F726C6421] => [2F6465762F7374646F7574]
Truth-machine
?CLASS? @StartClass@ ?METHOD? @Init@ {HEAD} [2D63] [31] [2F6465762F737464696E] => [2F7573722F2E2E2F7472757468] {ECHO} [2D6E] [30] => [2F7573722F2E2E2F31] % [2F7573722F2E2E2F7472757468] [2F7573722F2E2E2F31] ~Zero~ => [2F7573722F2E2E2F6A756E6B] ~Loop~ => [2F7573722F2E2E2F6A756E6B] {ECHO} [2D6E] [31] => [2F6465762F7374646F7574] % [2F7573722F2E2E2F31] [2F7573722F2E2E2F31] ~Loop~ => [2F7573722F2E2E2F6A756E6B] ~Zero~ => [2F7573722F2E2E2F6A756E6B] {ECHO} [2D6E] [30] => [2F6465762F7374646F7574]