User:PythonshellDebugwindow/Cmt
HTMLScript is an esolang by User:PythonshellDebugwindow based on HTML elements.
Syntax
Programs in HTMLScript are made up of a series of tags, which can be nested arbitrarily nested. Tags generally take the form of <tag>content</tag>
, where tag is the name of the tag and content is the code inside the tag; if the content inside the tag doesn't matter, you can instead use a self-closing tag: <tag />
, which is the same as <tag></tag>
. Tags can also contain any number of attributes, which take the form of <tag attr="value">content</tag>
, where attr is the attribute name and value is the attribute value (attributes can be used in self-closing tags as well). Alternatively, attributes can be written like name=`value`
, in which case value
will be evaluated as HTMLScript code. Normal content, such as Hello World!
, can be written normally, unless you have to write a left or right angle bracket, in which case you can use <l />
and <r />
respectively. Comments are enclosed in the <c>
tag.
Built-in tags
Tag | Attributes | Side effects | Evaluates to |
---|---|---|---|
output |
None | Outputs its contents (after evaluating any tags it contains) | Its contents |
input |
None | None | User input |
if |
condition |
Runs its contents iff condition is not empty or 0 |
Nothing |
element |
name |
Defines a custom tag; see #Custom tags | Nothing |
content |
None | None | The content of a custom tag |
Custom tags
Examples
Hello World!
<output>Hello World!</output>
Cat program until EOF
<element name="cat"> <output><content /></output> <if condition=`<content />`> <cat><input /></cat> </if> </element> <cat><input /></cat>
Truth-machine
<element name="one"> <output>1</output> <one /> </element> <if condition="<input />"> <one /> </if> <output>0</output>