curimit / SugarCpp

SugarCpp is a language which can compile to C++11.
135 stars 13 forks source link

Introducing LiveScript-style Cascades #21

Open curimit opened 11 years ago

curimit commented 11 years ago
a := Point(0, 0)
    . x = 1
    . y = 2

tree = new Tree()
    * left = new Tree()
        * v = 1
    * v = 2
    * right = new Tree()
        * v = 3

Compiles into:

auto a = Point(0, 0);
a.x = 1;
a.y = 2;

tree = new Tree();
tree->left = new Tree();
tree->left->v = 1;
tree->v = 2;
tree->right = new Tree();
tree->right->v = 3;