Index: doc/rob_thesis/examples/ctor/array_ctor.c
===================================================================
--- doc/rob_thesis/examples/ctor/array_ctor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
+++ doc/rob_thesis/examples/ctor/array_ctor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
@@ -0,0 +1,16 @@
+struct X { int x, y, z; };
+void ?{}(X *);
+void ?{}(X *, int);
+void ?{}(X *, int, int);
+void ?{}(X *, int, int, int);
+void ^?{}(X *);
+void f() {
+  X x[10] = { { 1, 2, 3 }, { 4 }, { 7, 8 } };
+}
+
+void g() {
+  X x[10][10] = {
+    { { 1, 2, 3 }, { 4 } },
+    { { 7, 8 } }
+  };
+}
Index: doc/rob_thesis/examples/ctor/copy_ctor.c
===================================================================
--- doc/rob_thesis/examples/ctor/copy_ctor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
+++ doc/rob_thesis/examples/ctor/copy_ctor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
@@ -0,0 +1,14 @@
+struct A;
+void ?{}(A *);
+void ?{}(A *, A);
+void ^?{}(A *);
+
+A f(A x) {
+  return x;
+}
+
+int main() {
+	A y, z @= {};
+	f(y);
+	f(z);
+}
Index: doc/rob_thesis/examples/ctor/cv_ctor.c
===================================================================
--- doc/rob_thesis/examples/ctor/cv_ctor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
+++ doc/rob_thesis/examples/ctor/cv_ctor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
@@ -0,0 +1,10 @@
+struct S { int i; };
+void ?{}(S *, int);
+void ?{}(S *, S);
+
+int main() {
+  const int i = 5;
+  volatile int j = i;
+  const S s = { 11 };
+  volatile S s2 = s;
+}
Index: doc/rob_thesis/examples/ctor/enum_ctor.c
===================================================================
--- doc/rob_thesis/examples/ctor/enum_ctor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
+++ doc/rob_thesis/examples/ctor/enum_ctor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
@@ -0,0 +1,3 @@
+enum Colour {
+  R, G, B
+};
Index: doc/rob_thesis/examples/ctor/expr_ctor.c
===================================================================
--- doc/rob_thesis/examples/ctor/expr_ctor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
+++ doc/rob_thesis/examples/ctor/expr_ctor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
@@ -0,0 +1,6 @@
+struct X {};
+void ?{}(X *, double);
+
+int f() {
+  X * x = malloc(sizeof(X)){ 1.5 };
+}
Index: doc/rob_thesis/examples/ctor/global_ctor.c
===================================================================
--- doc/rob_thesis/examples/ctor/global_ctor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
+++ doc/rob_thesis/examples/ctor/global_ctor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
@@ -0,0 +1,9 @@
+struct X {
+  int y, z;
+};
+void ?{}(X *);
+void ?{}(X *, int, int);
+void ^?{}(X *);
+
+X a;
+X b = { 10, 3 };
Index: doc/rob_thesis/examples/ctor/hide_ctor.c
===================================================================
--- doc/rob_thesis/examples/ctor/hide_ctor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
+++ doc/rob_thesis/examples/ctor/hide_ctor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
@@ -0,0 +1,12 @@
+struct S { int x; };
+
+int main() {
+  S s0; // okay
+  {
+    void ?{}(S * s, int i) { s->x = i*2; }
+    void ?{}(S *s) { }
+//    void ^?{}(S *s ) { }
+    S s1; // error
+  }
+  S s2; // okay
+}
Index: doc/rob_thesis/examples/ctor/placement_ctor.c
===================================================================
--- doc/rob_thesis/examples/ctor/placement_ctor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
+++ doc/rob_thesis/examples/ctor/placement_ctor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
@@ -0,0 +1,51 @@
+struct memory_pool {
+  char * start;
+  char * cur;
+  size_t size;
+  char * free;
+};
+
+void ?{}(memory_pool * pool, size_t size) {
+  pool->[start, cur] = malloc(size);
+  pool->size = size;
+  printf("initializing memory pool with size %lu at location %p\n", pool->size, pool->start);
+}
+
+void ^?{}(memory_pool * pool) {
+  free(pool->start);
+}
+
+forall(dtype T | sized(T))
+T * allocate(memory_pool * pool, unsigned int array_size = 1) {
+  size_t size = sizeof(T) * array_size;
+  printf("allocating block of size %lu...", size);
+  if (pool->cur + size < pool->start + pool->size) {
+    T * x = (T*)pool->cur;
+    pool->cur += size;
+    printf("success!\n");
+    printf("next address is %p\n", pool->cur);
+    return x;
+  } else {
+    printf("failed!\n");
+    // fail to allocate
+    return 0;
+  }
+}
+
+struct A {
+  int x, y, z;
+};
+void ?{}(A * a) {
+  a->[x,y,z] = [123, 456, 789];
+}
+
+int main() {
+  memory_pool pool = { 1024 };
+
+  int * x = allocate(&pool);
+  A * a = allocate(&pool);
+  A * b = allocate(&pool, 1000);
+  a{};
+  printf("%p\n", x);
+  printf("%p %d %d %d\n", a, a->[x,y,z]);
+}
Index: doc/rob_thesis/examples/ctor/return_dtor.c
===================================================================
--- doc/rob_thesis/examples/ctor/return_dtor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
+++ doc/rob_thesis/examples/ctor/return_dtor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
@@ -0,0 +1,20 @@
+struct A;
+void ?{}(A *);
+void ^?{}(A *);
+
+void f(int i) {
+  A x;  // construct x
+  {
+    A y; // construct y
+    {
+      A z; // construct z
+      {
+        if (i == 0) return; // destruct x, y, z
+      }
+      if (i == 1) return; // destruct x, y, z
+      // destruct z
+    }
+    if (i == 2) return; // destruct x, y
+    // destruct y
+  }
+}
Index: doc/rob_thesis/examples/ctor/static_ctor.c
===================================================================
--- doc/rob_thesis/examples/ctor/static_ctor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
+++ doc/rob_thesis/examples/ctor/static_ctor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
@@ -0,0 +1,12 @@
+struct X {
+  int y, z;
+};
+void ?{}(X *);
+void ?{}(X *, int, int);
+void ^?{}(X *);
+
+int f(int x) {
+  static X a;
+  static X b = { x, x };
+  static X c = b;
+}
Index: doc/rob_thesis/examples/ctor/union_ctor.c
===================================================================
--- doc/rob_thesis/examples/ctor/union_ctor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
+++ doc/rob_thesis/examples/ctor/union_ctor.c	(revision 9c14ae94c6baf3aa3a91be49b0076852ea86e5ef)
@@ -0,0 +1,6 @@
+struct Y { int a; };
+struct Z { double z; };
+union X {
+  Y y;
+  Z z;
+};
