Skip to content

McYoloSwagHam/HTML-as-programming-language

 
 

Repository files navigation

HTML-as-programming-language

Build Status We aim to build a programming language that looks like HTML. The current syntax it is HTML-inspired / XML-based but we hope be be fully 100% HTML based in the future.


Examples

<def multiplyFunction returns=int> <!-- You can create fucntions -->
    <param a type=int/>
    <param b type=int/>

    <return>a * b</return>
</def>

<def main>
    <var result type=int> <!-- Create variables -->
        <multiplyFunction> <!-- and store the result of the function in the variable -->
            <param>5</param>
            <param>6</param>
        </multiplyFunction>
    </var>
</def>
<def main>
    <var myInt=6/> <!-- Create variables -->
    <assign myInt=10/> <!-- reassign variables -->
    <multiply myInt>myInt</multiply> <!-- * -->
    <divide myInt>3</divide> <!-- / -->
    <minus myInt>10</minus> <!-- - -->
    <add myInt>2</add> <!-- + -->
    <modulo myInt>myInt</modulo> <!-- % the remainder when divided -->
</def>
<pile myVeryCoolPile type="boolean">  <!-- Array of booleans -->
    <thing>cake</thing> <!-- True -->
    <thing>lie</thing> <!-- False -->
    <thing>cake</thing>
    <thing>lie</thing>
    <thing>cake</thing>
    <thing>lie</thing>
    <thing>lie</thing>
    <thing>cake</thing>
    <thing>lie</thing>
</pile>

And many more on the wiki

https://github.com/HTML-as-programming-language/HTML-as-programming-language/wiki


Installation & requirements

Requirements

  • Python 3 (tested with Python 3.7)

    To compile and upload to Arduino/AVR microcontrollers:

  • avr-gcc

  • avrdude

Installation

PyPi package (project page):

pip install HTML-as-programming-language

Visual Studio Code extention

Get live code diagnostics by downloading HTML-as-programming-language for VSCode.

(This extention requires 'HTML-as-programming-language' itself)

Language Server

If you wish not to use VSCode but still want live code diagnostics you can use the HTML-language-server.

The language server can be started with the following command:

htmlclangsvr

Usage

Transpile HTML-code to C-code:

htmlc my-code.html

This wil output C-code to ./out/my-code.c

If you want to write code for Arduino/AVR read the next section.

Write code for Arduino/AVR microcontrollers:

To write code for Adruino/AVR microcontrollers, (Arduino UNO for example) you need to put a DOCTYPE tag in your HTML file.

For example:

<!DOCTYPE avr/atmega328p>

Simply type 'avr/' followed by the microcontroller name. (atmega328p is the name of the microcontroller used by Arduino UNO)

Compile

To compile your AVR/Arduino code:

htmlc my-code.html -compile

Upload to Arduino/Microcontroller

To upload your code to an arduino or other AVR microcontroller:

htmlc my-code.html -upload

About

We aim to build a programming language that looks like HTML

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 83.4%
  • TypeScript 6.5%
  • C 6.5%
  • HTML 3.6%