Giter Site home page Giter Site logo

zanderlewis / html-language Goto Github PK

View Code? Open in Web Editor NEW

This project forked from html-as-programming-language/html-as-programming-language

2.0 0.0 0.0 192 KB

A programming language that looks like HTML. My copy with enhanced features and brought back to life from 4 years ago.

Home Page: https://html-as-programming-language.github.io/

Python 83.47% C 6.46% TypeScript 6.47% HTML 3.59%

html-language's Introduction

Hyper Text MACHINE Language

HTML-as-programming-language

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


Examples

<def multiplyFunction returns=int> <!-- You can create functions -->
    <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>
<!-- starting expression with condition -->
<expression x="a > 1">
	<!-- if a > 1 -->
	<ya-really>
		<!-- printf "a is greater than one (1) -->
		<printf>
			"a is greater than one (1)"
		</printf>
	</ya-really>

	<!-- else if a == 0 -->
	<maybe x="a == 0">
		<printf>
			"a is equal zero (0)"
		</printf>
	</maybe>

	<!-- else -->
	<no-wai>
		<printf>
			"a is minor than zero (0)"
		</printf>
	</no-wai>
</expression>
<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 do not wish 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

html-language's People

Contributors

0xsmn avatar hilkojj avatar timostrating avatar zanderlewis avatar

Stargazers

 avatar  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.