Skip to content

mitchell/madmaan

Repository files navigation

alt tag

Introduction

Madmaan is a dynamically and strong typed language that simplifies JavaScript's syntax and looks M A D S I C K, man. Hate semi-colons? Well, try out exclamation marks! Does using "!" for "not" not make sense? Okay, use "NOT" instead, M A N. Plus, we know how ugly {} can be. S O. N O. C U R L Y. B R A C K E T S, M A N. This language explodes(compiles) into JavaScript, now go get M A D, M A A N.

Features

  • dynamically typed
  • strongly typed
  • object-oriented
  • imperative
  • functional
  • first-class functions
  • higher-order functions
  • pattern matching

For all intents and purposes, the left is madmaan, and the right is JavaScript.

Default keywords

elif                                       else if

while boolean do                           while (boolean)

inherits                                   extends

mad                                        class

create                                     new

Anything unlisted, is the same as JavaScript.

Keyword Parameters

for variable initialization! condition! increment!

if condition then                         if (condition)
    !                                         ;
elif condition then                       else if (condition)
    !                                         ;
else                                      else
    !                                         ;
!!

while condition do                         while (condition);

mad Object(paramX,...,paramY)              function() Object(paramX,...,paramY)

showMe strlit!                             console.log(strlit);

condition or condition                     condition || condition

condition and condition                    condition && condition

Programming examples

If-else statements

if boolean then                             if (boolean) {
  showMe "First condition true"!               console.log("First condition true");
elif boolean then                           } else if (boolean) {
  showMe "Second condition true"!              console.log("Second condition true");
else                                        else {
  !  
!!                                           ;
                                            }

While Loops

while boolean do                            while (boolean) {
  showMe "This is a gr8 language!"!            console.log("You should try madmaan!");
!!                                          }

For Loops

for i is 0! i < 10! i++!                     for (var i = 0; i < 10; i++) {
  showMe "This loops 10 times"!                  console.log("This loops 10 times");
!!                                          }

Classes, instantiation, super classes, implements

mad Fruit()                                   class Fruit() {
  this.isEdible = true!                          this.isEdible = true;
                                              }
mad Apple inherits Fruit()                    class Apple extends Fruit() {
  this.type = "Macbook"!                         this.type = "Macbook";
  this.color = "red"!                            this.color = "red";
                                              }
apple = create Apple("Macbook", "red")!       var apple = new Apple("Macintosh", "yellow");

Comments

// Single-line Comments                      // Single-line Comments    
/* Multi-line Comments */                    /* Multi-line Comments */

Hello World

showMe "Hello, World"!                         console.log(“Hello, world!”);

Function Declaration

multiply is (a, b) =>                          let multiply = (a, b) => {
    return (a * b)!                                  return (a * b);
!!                                             }   

Comparison Operators

Equal (==)
a == b!                                                     a == b;

Not equal (!=)
a ~= b!                                                      a != b;

Greater than (>)
a > b!                                                       a > b;

Less than or equal to (<=)
a <= b!                                                       a <= b;

Logical Operators

NOT (~)
~x                                                             !x

AND (and)
a and b                                                      a && b

OR (or)
a or b                                                       a || b

Variable Declarations

a is 1!                                                       var a = 1;
b is "dog"!                                                   var b = "dog";
c is true!                                                    var c = true;
d is false!                                                   var d = false;

Arrays

cars = ["Saab, "Volvo", "BMW"]!                               var cars = ["Saab", "Volvo", "BMW"];
points = create Array(40)!                                    var points =  new Array(40);
cars[0] = "Opel"!                                             cars[0] = "Opel";
name = cars[0]!                                               var name = cars[0];

About

madmaan - a mad programming language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published