Giter Site home page Giter Site logo

mythology's Introduction

Mythology

A small, simple and type safe programming language.

Running

$ git clone https://github.com/ihavenonickname/Mythology.git
$ cd Mythology
$ node mythology <path to your myth script> <options>

CLI options are

  • --run Runs your code
  • --ast Prints the abstract syntax tree of your code

Example code

function do_stuff (text str) text do
    number count = 8;

    while count > 0 do
        print(str);

        count = count - 1;
    end

    draw_matrix(10);

    return "Works like a charm";
end

# We got a comment
function draw_matrix (number size) do
    number n_row = 0;

    while n_row < size do
        number n_col = 0;
        text line = "";

        while n_col < size do
            if modulo(n_col + n_row, 2) is 0 do
                line = line + "X ";
            else
                line = line + "O ";
            end

            n_col = n_col + 1;
        end

        print(line); # Yep, a comment

        n_row = n_row + 1;
    end
end

function main () do
    print(do_stuff("Hello world from Mythology"));
end

This project is in very early stage.

mythology's People

Contributors

ihavenonickname avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mythology's Issues

format option

There should be a --format CLI option which formats (beautify) the source code.

Introduce comments

Mythology lang accepts no comments yet.

Comments should start with a sharp, be one-liners and ignored by the lexer (just like in Python).

Elif

Permit elif construction.

if modulo(i, 15) is 0 do
    print("FizzBuzz");
elif modulo(i, 3) is 0 do
    print("Fizz");
elif modulo(i, 5) is 0 do
    print("Buzz");
end

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.