Friday, April 1, 2011

Exciting New Changes

During the time that we have been developing Crack, we have gotten a lot of
really good constructive criticism on the language.  This criticism has not
fallen upon deaf ears, and I am happy to announce some exciting changes coming
to the next version of Crack.

For one thing, it has been pointed out that naming the language after an
illicit drug that ruins people's lives may not have been the best decision. 
It's also hard to find information on the language by doing a search for
"crack" and the name is already overloaded in software technology to refer to
password cracking tools.

In response, we are changing the name of the language to "MINARA`"  This is an
enormously clever abbreviation of "Minara Is Not A Recursive Acronym`" 
Unfortunately, this name is already in use by an open-source vector drawing
tool (see so we have added the back-tick
character to the end of our name for purposes of disambiguation.

Another long-standing criticism of Crack (excuse me, MINARA`) has been that
there are already an abundance of C-like languages.  We acknowledge this, and
as such we are changing the entire syntax of the language.  As of the next
release, the language will instead adopt a Lisp-like syntax.

Unfortunately, Lisp is impossible for humans to read and is also more targeted
towards interpretation than compilation.  So MINARA` will adopt the following
syntactic and semantic conventions:

  • The basic lisp form of a function followed by its arguments will be preserved.  A MINARA` script will be a a list of such functional forms.
  • The resulting data structure is a nested list that can be thought of as the Abstract Syntax Tree for a MINARA` module.
  • Similar to Lisp, there are macros that are forms executed at compile time.  These are free to interpret any of the special types of lists any way they want, but they are applied after the processing of the comma and semicolon syntactic sugar defined below.  All of the basic statements (if/else, while, for, class...) are implemented as macros.
  • The following special syntactic conventions apply:
    • Unlike Lisp, which has a single parenthesized list type, MINARA` has four types of lists: a-lists, b-lists, c-lists and p-lists.
    • p-lists are the normal parenthesized Lisp function calls
    • A list enclosed in curly braces is like a quoted list in Lisp: it is not evaluated, it is a value.  Example: (print {1 2 3}). A macro may choose to compile the contents of a c-list, which makes them very suitable for statement blocks.  This is a c-list (a curly bracketed list).
    • The semicolon is syntactic sugar that is equivalent to enclosing all elements to the last semicolon or the beginning of the enclosing list in parenthesis.  For example, {print "hello"; print "world";}  is equivalent to {(print "hello") (print "world")}  The terminating semicolon is optional: if at least one semicolon is in the enclosing list, the entire enclosing list is split up into p-lists.
    • The square brackets are equivalent to a call of the "expr" function in the current context.  "expr" defaults to a macro that converts its arguments from a more traditional, infix style to the canonical, prefix list style.  Example: [a = b * 2 + 3] is equivalent to (expr b * 2 + 3) which would normally be transformed at compile time to (= a ((* b 2) 3))  This is a b-list (a "bracketed list")
    • The comma is similar to the semicolon.  The comma aggregates all elements up to the previous comma with the exception of the first element in the enclosing list into a b-list.  For example, (print 'value is', 1 + 2) is equivalant to (print ['value is'] [1 + 2]) or (print (expr 'value is') (expr 1 + 2)) or (print 'value is' (+ 1 2)) 
    • an element followed by a period and an identifier is equivalent to a call of the "attrex" function with the items before and after the period passed as arguments (like "expr", "attrex" is normally implemented as a macro which expands to various kinds of low-level attribute and member function access).  So (foo.setBar 'test') would be equivalent to ((attrex foo setBar) 'test').  This is an a-list ("attribute list")

All of syntactic constructs in MINARA` will be implemented as macros.  Here's an example of a class definition with some instance variables and methods:

    # Defined using a "class" macro, note that the base classes 
    # (Object and Named) must be specified in a list
    class Person : (Object Named) {
        # instance variable definitions.  Since we have to start
        # these with the name "var" we adopt pascal style
        var name : String, favorite_color : Color =;
        # the "duh" keyword in oper init indicates that arguments 
        # map trivially to their corresponding attributes.
        oper init(name; favorite_flavor) duh;
        # a couple of explicit implementation of abstract 
        # functions from Named
        implement setName(name: String) { name = newName; };
        implement getName() returns String { return name; };
        def isCompatibleWith(other: Person) returns bool {
            if [other.favorite_color == favorite_color] {
                return true;
            } else {
                return false;
        def clone() returns Person {
            return ( name favorite_color);

We think that everyone will appreciate these new changes to the language, and
apologize for our earlier mistakes.

No comments:

Post a Comment