My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Links

The Crack Programming Language

Crack aims to provide the ease of development of a scripting language with the performance of a compiled language. The "crack" program is a "script executor" that compiles source to machine code on the fly (it will eventually cache the code to intermediate formats as appropriate). It can also compile a script to a native binary.

The crack language itself derives concepts from C++, Java and Python, incorporating object-oriented programming, operator overloading and strong typing.

Crack is still evolving. For minor version changes there is currently no guarantee of compatibility between versions, this situation will change when we get to 1.0, at which point backwards compatibility will be guaranteed until the next major version change. In the meantime, tertiary version changes should be backwards compatible, and some features may be added to the executor to help users during a version upgrade.

News

Get Crack!

Warning: While crack 0.6 is a lot more stable and complete than earlier versions, it is still an early version of the language that is deficient in features and probably still has a few bugs. Caveat emptor.

You'll need: LLVM 3.0, and Crack 0.6.1.

Follow the instructions in the INSTALL file in the crack tarball.

Documentation

See The Manual.

See also the notes for lots of disorganized thoughts on what the language will be like.

Installing from the Source Repository

You probably don't want to do this unless you want to do some development on Crack: most users will want to download the tarballs as identified above.

Check the "Source" folder for information on how to pull from the CVS repositories. You'll need both the spug++ and crack repositories.

  1. Build and install LLVM Version 3.0
  2.   tar -xvzf llvm-3.0.tgz
      cd llvm-3.0.src
      ./configure --enable-assertions
      make
      su -c make install
    Add the options --disable-optimized --enable-debug-runtime during configure if you want to be able to debug LLVM, but be advised that this will significantly decrease performance and increase binary size. Avoid it unless you need to debug something through to the LLVM code.
  3. Get the latest crack code:
  4.   hg clone https://crack-language.googlecode.com/hg/ crack-language
      cd crack-language; ./bootstrap; ./configure; make; make check; sudo make install
    If you get errors during bootstrap, try going back into crack-language-spugxx and running sudo make install-autoconf
  5. try it out:
  6.   echo 'import crack.io cout; cout `hello world!\n`;' | crack -l lib - 

Contact Info

For questions, send mail to crack-lang-dev@googlegroups.com or stop by the IRC channel on FreeNode: #crack-lang.

Sample Code

This script builds a set of unique values from the argument list and prints its contents.

# import what we need from the appropriate modules
import crack.io cout, Formatter;
import crack.sys argv;
import crack.strutil StringArray;
import crack.cont.treemap TreeMap;

## Cheesey set implementation.
class ArgSet {
    
    # set of all args
    TreeMap[String, int] __raw = {};
    
    ## initialize the set from the arg list.
    oper init(StringArray args) {

        # transfer args from the array to the set
        uint i = 1;
        while (i < args.count()) {
            __raw[args[i++]] = 1;
        }
    }

    ## Dump the set
    void dump() {
        for (item :in __raw)
            cout `got $(item.key)\n`;
    }
}

# initialize the arg set from the actual args
ArgSet a = {argv};

# write the set
a.dump();
Powered by Google Project Hosting