Skip to content

Htmlp Syntax

Ante Novokmet edited this page Mar 25, 2020 · 1 revision

Welcome to the htmlp wiki!

Variables

<identifier name="x"></identifier>

Literals

<literal value="2"></literal>

Declaration

<declare name="x"></declare>

Assignment

<assign>
    <identifier name="x"></identifier>
    <literal value="2"></literal>
</assign>

Operations

<operation type="+">
    <literal value="2"></literal>
    <literal value="2"></literal>
</operation>

Conditionals

<if>
    <operation class="test" type="==">
        <identifier name="x"></identifier>
        <literal value="2"></literal>
    </operation>
    <div class="then">
        <!-- executes if x == 2 -->
    </div>
    <div class="else">
        <!-- executes if x != 2 -->
    </div>
</if>

Loops

<loop>
    <assign class="step">
        <identifier name="i"></identifier>
        <operation type="+">
            <identifier name="i"></identifier>
            <literal value="1"></literal>
        </operation>
    </assign>
    <declare class="init" name="i">
        <literal value="0"></literal>
    </declare>
    <operation class="test" type="<">
        <identifier name="i"></identifier>
        <literal value="10"></literal>
    </operation>
    <div class="body">
        <!-- executes 10 times -->
    </div>
</loop>

Functions

<function name="add">
    <identifier class="parameter" name="a"></identifier>
    <identifier class="parameter" name="b"></identifier>
    <div class="body">
        <return>
            <operation type="+">
                <identifier name="a"></identifier>
                <identifier name="b"></identifier>
            </operation>
        </return>
    </div>
</function>
Clone this wiki locally