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.
- 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.
elif else if
while boolean do while (boolean)
inherits extends
mad class
create new
Anything unlisted, is the same as JavaScript.
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
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 boolean do while (boolean) {
showMe "This is a gr8 language!"! console.log("You should try madmaan!");
!! }
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");
!! }
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");
// Single-line Comments // Single-line Comments
/* Multi-line Comments */ /* Multi-line Comments */
showMe "Hello, World"! console.log(“Hello, world!”);
multiply is (a, b) => let multiply = (a, b) => {
return (a * b)! return (a * b);
!! }
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;
NOT (~)
~x !x
AND (and)
a and b a && b
OR (or)
a or b a || b
a is 1! var a = 1;
b is "dog"! var b = "dog";
c is true! var c = true;
d is false! var d = false;
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];