by Matt Giuca
This project appears to have gone dormant. It will be removed from the list soon unless new activity is noted.
Hybrid imperative/declarative higher-order language with automatic destructive update.

Mars is a very simple imperative programming language with a catch: all of the functions and expressions are pure.

That means when you call a function, it is guaranteed to have no side-effects: it can't mutate its arguments, modify global variables, or perform input/output. But unlike other pure languages, Mars gives you all the nice features of imperative programming, like local variable assignments and loops. The compiler also automatically converts inefficient copy-and-update operations into in-place destructive operations.

Mars also has some other nice features borrowed from functional programming: a strong static type system, algebraic data types, pattern-matching switch statements, and higher-order functions.

#!/usr/bin/env mars

# Name Repeat

import prelude

def main() :: io Num:
    var l :: Array(Num)
    print_string("What is your name? ")
    l = get_line()
    if l == "":
        print_string("You forgot to enter a name!\n")
        print_string("Hello, ")
    return 0
Information updated 08/28/15
View Comments