Code Monkey home page Code Monkey logo

mapleleaf's Introduction

mapleleaf

An interpreted language made purely in Python. It does not use any external libraries such as lex/yacc, and is currently a work in progress.

Features

Variable declaration
var a = 0;
var b = 2;
Basic arithmetic and order of operations
print((3+5)*(2)); # 16
Some neat high-level features
var q = "Hello";
var r = 0;

# Overloaded + operator for string-int concatenation
print(q+r) # "Hello0"
var s = "Hello";
var t = "ell";

# Removes the first occurence of t in s
print(s-t); # "Ho"
Block scoping
{
    var a = "Hello, World!";
    print("Printing from inside block: " + a); # OK
}

print("Printing from outside block: " + a); # Runtime error
For/While loops
var i = 0;
from (; i < 10; i = i + 1) {
    print("Hello");
}

until (i < 20) {
    print("World");
}
Nested for/while loops
from (var i = 0; i < 3; i = i + 1) {
    from (var j = 0; j < 3; j = j + 1) {
        print(i+j);
    }
}

# Output
0
1
2
1
3
2
3
4

To use the language, run mapleleaf.py with sample.maple as an argument

mapleleaf's People

Contributors

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