Giter VIP home page Giter VIP logo

chtml's Introduction

CHTML

This is a transpiler which transforms the HTML markup language into a full working turing programming language.

How to use

python ./main.py <input_html_name> <output_binary_name>

example:
python ./main.py ./programs/fibonacci.html output

Documentation

As a generale rule, the id property is considered the identifier and class property is considered the type.

Minimal program:

<html>
    <head></head>
    <body>
        <div id="main" class="int">
        </div>
    </body>
</html>

Primitives:

numbers

<p>10</p>

strings

<p>"hello"</p>

Expressions

Add 10 and 20

<h1>
    <p>10</p>
    <p>20</p>
</h1>

Subtract 10 from 20

<h2>
    <p>20</p>
    <p>10</p>
</h2>

Multiply 10 and 20

<h3>
    <p>10</p>
    <p>20</p>
</h3>

Divide 20 by 10

<h4>
    <p>20</p>
    <p>10</p>
</h4>

Add variable a and 10

<h1>
    <link href="a">
    <p>10</p>
</h1>

Check if a and b are true

<h5>
    <link href="a">
    <link href="b">
</h5>

Check if a or b are true

<h6>
    <link href="a">
    <link href="b">
</h6>

Not a

<u>
    <link href="a">
</u>

Check if a equals b

<i>
    <link href="a">
    <link href="b">
</i>

Check if a is less than b

<b>
    <link href="a">
    <link href="b">
</b>

Check if a is greater than b

<strong>
    <link href="a">
    <link href="b">
</strong>

Call function fibonacci with argument 5

<ul id="fibonacci">
    <li><p>5</p></li>
</ul>

Statements

create a new variable a of type int which will be initializated with 10.

<span id="a" class="int">
    <p>10</p>
</span>

change the value of variable a to 20 ( we don't use the class property)

<span id="a">
    <p>20</p>
</span>

create an if statement. the thead is the condition for the if statement, tbody are the statements if the for the true branch and tfoot the statements for the false branch.

<table>
    <thead>
        <b>
            <link href="a">
            <p>20</p>
        </b>
    <thead>
    <tbody>
        <ul id="print">
            <li><p>"success"</p></li>
        </ul>
    </tbody>
    <tfoot>
        <ul id="print">
            <li><p>"failure"</p></li>
        </ul>
    </tfoot>
</table>

create an infinite loop with textarea, and use the hr to break from the loop

<textarea>
    <table>
        <thead>
            <b>
                <link href="a">
                <p>0<p>
            </b>
        <thead>

        <tbody>
            <hr>
        </tbody>
    </table>
<textarea>

Functions

Create a new function named fibonacci which will return an int

<div id="fibonacci" class="int">
</div>

Parameters

Fibonacci function will receive a parameter of type int identified n. The parameters declaration location doesn't need to be at the begining of the function

<div id="fibonacci" class="int">
    <ol>
        <li class="int">n</li>
    </ol>
</div>

Return

Fibonacci function will return the number 10

<div id="fibonacci" class="int">
    <a>
        <p>10</p>
    </a>
</div>

chtml's People

Contributors

catalyn45 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.