Turing Complete DOM Programming Language
Designed by | Andriy |
---|---|
Appeared in | 2022 |
Type system | dynamic |
Dimensions | one-dimensional |
Computational class | Turing-complete |
Major implementations | itch.io download link |
Dialects | None |
Influenced by | XML, Python |
File extension(s) | .xml |
Turing Complete DOM Programming Language is an esoteric programming language created by User:Andriy where every code is also an xml file. You can download it here.
Hello World
Here is a code that prints hello world:
<?xml version="1.0" ?> <code> <function name="main" id="1"> <line> <command>PRINT</command> <arg1>Hello, world!</arg1> </line> </function> </code>
Architecture
Functions
The code is divided to functions. Each function has two attributes, a name and an id. Its possible to call a function using its id or using its name. The id is supposed to be unique but if it isn't calling by id will call the one that appears the latest. The name of the function is not meant to be unique. If you try to call a function using its name, and multiple functions exist with this name, the interpreter will choose a random one and run it. This can be used to create a primitive random number generator.
When the xml file is parsed and the code is loaded to memory, a dictionary is created that associates each function name with a list of ids. If two functions share the same id and name, only the last one will be called. However, if two functions have different names but the same id, calling the first one by name will cause the second one to be called.
When the code starts, it will call the main function using its name. If the programmer chooses to create multiple functions with the name main, the interpreter will choose a random one and run it.
Lines
Each function is divided to lines. Lines do not require any attributes. Their parameters are command and up to 4 arguments (arg1, arg2, arg3, arg4). Most functions will only require one or two arguments. When a function is called, it will run all the lines one by one in the order listed in the function.
List of commands
}Command | Description |
---|---|
TYPE <arg1>
|
Prints the value of <arg1> without a new line character at the end |