Giter Site home page Giter Site logo

mino's Introduction

Mino

Mino compiler. Need

  • Tangara - official parser of Mino. Frontend of Mino.
  • TokensBuilder.NET - compiler to CIL. Backend of Mino for .NET. Now compiler works only on Windows (.NET Framework 4.5)

How to compile & run programs on Mino

For compile&run programs on Mino, use run.bat. Open command line in this folder and type run program1. You can see how program1.mino was compiled and runned. You can see working program on Mino. If you wanna create own program on Mino:

  • Create text file in this folder with .mino extension
  • Write some code
  • Open cmd in this folder and write run YourFileNameWithoutExtension and if you make all right - you can see own working program on Mino
  • Great! You write own first program on Mino programming language

Syntax

Main feature of this programming language is You can change syntax. The syntax can be changed by creating and using platforms (dialects).

How it work

A platform (or dialect) in Mino is a JSON (in the future it can be both XML and YAML) a file representing a dictionary, in which the key is the name of the replacement keyword or operator, and the value is a string (word or sign, or several characters ), which will denote this token in the program.
platform-example
This is example of small platform

For example check two different programs and linked to two different platforms: platform-code1 platform-code2
However, they will be compiled into the same tokens. So how does it work? On the left are simple platforms that resemble dictionaries. The key in them is the name of the token, and the value is the token that will be converted to this token. To demonstrate how this works, let's look at the third line of both platforms, which describes a token called variable_keyword, which is responsible for starting variable declaration(s). In the first case, we "told" the compiler that we will declare variables with the var keyword, and in the second - variable. Thus, during parsing, the parser, when it checks the token with the value that we set in the platform, will write the token that we set for this token.

Base syntax (without platforms)

This syntax duplicate in platform std

Sample programs

Always working sample you can watch in -> program1.mino. Also you can find working examples in -> examples folder

Programs for future working compiler of Mino

Hello World

lib standard;
println("Hello World");

Loops

lib standard;
do {
    print("Enter word 'hello': ");
} while (input() != "hello");
var a = 0.0;
while ((a^10) > 100) {
    println("Enter the number that equals 100 to the power of 10");
    try {
        a = input() to double; // in the standard library, the ability to explicitly convert from string type to any numeric type
        // without functions by the parseInt type has been created
    } catch (NumberFormatException) {
        println("You enter not number. Break loop");
        break;
    }
}
for (int i = 0; i < 200; i++) {
    println(i);
}
/*
for (counter i = 0; i < 100000000; i.inc() /*i++*/) {
    println(i/1000); //counter is a special number type in TokensStandard library which optimize use of memory
}
*/
var names = ["Alisa", "Alexander", "Maxim", "Anna", "Michael", "John"];
foreach (string name in names) { // you can replace 'string' by 'var'
    println("Hello $name");
}

Very simple class

lib standard;

class MyClass {
    private final var name = "Alexander";

    fun printName() {
        println(name);
    }

    static var int age = 20;

    static fun printSqrOfAge() {
        println(age^2);
    }
}

Template of script for Unity game

include UnityEngine.dll;

//lib standard;

use UnityEngine;

class MyScript : MonoBehaviour {
    fun Start() {
        Debug.Log("Script was started");
    }

    fun Update() {
        Debug.Log("New frame");
    }
}

mino's People

Contributors

snaulx avatar

Stargazers

 avatar  avatar

Watchers

 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.